Passage à ASP.NET vNext

vnext
Paul Schneider 8 years ago
parent ea90fefc31
commit 388b004837
1929 changed files with 104611 additions and 235941 deletions

39
.gitignore vendored

@ -1,25 +1,18 @@
*/bin
*/obj
plugins/*/bin
plugins/*/obj
*.userprefs
packages
web/avatars
web/users
dist
bower_components
node_modules
svg
web/bfiles
web/App_Themes/style.totem.css
web/Web.Debug.config
web/Web.Release.config
web/Web.Lua.config
web/Web.LuaDebug.config
web/Web.TotemPre.config
web/Web.Totemprod.config
.nuget
.gitignore
web/Web.*.config
.gitignore
appsettings.*.json
.idea/
.vscode/
YavscWeb.userprefs
bin/
bower_components/
node_modules/
docfx_project/
debugcmd
debugcode/
kestrel*.pid
kestrel*.log
scaffold.cmds
DataProtection-Keys
RSA-Params.json

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Machine.Specifications.Runner.Console" version="0.9.0" />
</packages>

Binary file not shown.

@ -1,115 +0,0 @@
2015-12-30 Paul Schneider <paul@pschneider.fr>
* .gitignore: ignore ma config LuaDebug
2015-12-24 Paul Schneider <paul@pschneider.fr>
* Makefile:
* Yavsc.sln: ajout d'une configuration de debuggage pour Lua
2015-12-23 Paul Schneider <paul@pschneider.fr>
* .gitignore: une typo
2015-12-15 Paul Schneider <paul@pschneider.fr>
* Makefile: utilise le fichier de conf généré pour débugger.
* README.md: maj priorités
2015-12-09 Paul Schneider <paul@pschneider.fr>
* README.md: mise à jour des priorités
2015-12-01 Paul Schneider <paul@pschneider.fr>
* README.md: mise à jour priorités
2015-12-01 Paul Schneider <paul@pschneider.fr>
* README.md: mise à jour des priorités
2015-12-01 Paul Schneider <paul@pschneider.fr>
* Makefile: fixe le déploiement multiple en un appel
2015-12-01 Paul Schneider <paul@pschneider.fr>
* README.md: mise à jour des priorités
2015-11-30 Paul Schneider <paul@pschneider.fr>
* .gitignore: ignorer ma config
* Features.md: précisions sur les rôles
2015-11-30 Paul Schneider <paul@pschneider.fr>
* README.md: mise à jour des priorités
* Yavsc.sln: ajout du fichier "Features.md" à la solution
2015-11-30 Paul Schneider <paul@pschneider.fr>
* Makefile: Fixe: ne pas déployer sans hôte de destination
Ajoute: le déployement de tous des sites en prod, avec la
cible `syncall`
2015-11-26 Paul Schneider <paul@pschneider.fr>
* Makefile:
* Yavsc.sln: nouvelles configurations de déploiement
2015-11-23 Paul Schneider <paul@pschneider.fr>
* .gitignore: ignorer les configuration des pré et prod totem.
2015-11-21 Paul Schneider <paul@pschneider.fr>
* Makefile: retour au débuggage de la copie de travaille, et
pas de la déployée
2015-11-19 Paul Schneider <paul@pschneider.fr>
* .gitignore: ignore my new config transformation sources
* Makefile: instead of `deploy`, start Xsp, in the `dist`
folder
* Yavsc.sln: Lua config
2015-11-18 Paul Schneider <paul@pschneider.fr>
* Makefile: adds my deployment targets
2015-11-17 Paul Schneider <paul@pschneider.fr>
* Makefile: adds nuget targets
2015-11-14 Paul Schneider <paul@pschneider.fr>
* Makefile: Fixes the `clean` target
* README.md: WIP Skills
2015-11-11 Paul Schneider <paul@pschneider.fr>
* README.md: \n @ EOF
* Yavsc.sln: remove the `booking` project from the solution
* Edit.aspx: cleaning
2015-11-08 Paul Schneider <paul@pschneider.fr>
* README.md: Adds a TODO list
* Yavsc.sln: do not build the MVC 5.1 project, that does not
run under mono.
* ChangeLog: this file should not be maintained as a git
respository legacy file
* .gitignore: this file should not be maintained under git

@ -1,55 +0,0 @@
# Fonctionalités
# Une publication des talent du site
Des notions de *préstataire*, d'*activité* et de *compténces*
dirigent maintenant le "link juice":
Sont publiées en home page les descriptions en temps réel des activités soutenues par au mois un préstataire enregistré, ayant déclaré son statut de préstataire par un choix parmis les activités configurée par l'administration du site.
Le prestataire peut détailler ses compétences, en leur donnant une côte de départ, qui sera modifiée par les clients de ce prestataire, une fois le service rendu.
Les membres du FrontOffice sont seuls, avec les administrateurs tout puissants, à pouvoir éditer les activités et compétences du site.
Les préstataires ne font que choisir parmis les compétences liées à l'activité qu'il auront choisi.
# Une reservation de préstataire
Le préstataire peut renseigner un identifiant de calendrier Google.
Dans ce cas, à la proposition de la reservation de ses services,
on peut verifier (à l'aide d'un algorythme à rendre modulaire)
sa disponibilité et présenter au client un peu plus de confiance
dans le succès de sa demande de reservation.
La fiche prestataire presente aussi, le cas échéant, un lien vers son blog (à l'existence de billets publiques).
Le processus de reservation d'un préstataire peut être conduit par un utilisateur anonyme (non enregistré sur le site) jusqu'à la validation de son panier de commandes.
## Un blog spot
Une fois endossé le rôle de `Blogger`, On peut poster des billets, avec une mise en forme stockée à la Markdown en base de donnée,
en WYSIWYG depuis l'interface Web grâce à un fork de hallo.js .
La syntaxe a été etendue pour pouvoir publier, en tant qu'objet du document, des vidéos et fichiers audio.
On peut attacher toute sorte de document à chacun des billets.
# Un système de facturation
Pour l'instant, il est réduit au minimum : un édition d'un devis, qui à la publicaton en LaTeX ou Pdf est présenté comme une facture.
## Peut-être à desactiver ? à rendre optionnel au niveau administratif et utilisateur : le systeme de fichiers utilisateur
Tout utilisateur enregistré dispose aussi du moyen de publier des applications de son choix, via son espace de fichiers perso ou ses billet de blog.
# La conformité légale
Hors mis les mentions légales concernant la responsabilité du site,
un système d'avertissement unique par utilisateur à été mis en place.
Il a été mis en oeuvre pour prévenir tout nouvel utilisateur, qu'en parcourant ce site,
il accèpte le stockage de données persistantes sur son ordinateur, appélées "cookies"
destinées à lui faciliter son expérience du site ...
Il reste à prévenir de l'utilisation des liens vers les réseaux sociaux (pour l'instant, seulement Google Plus).

@ -1,139 +0,0 @@
using System;
using Yavsc;
using Npgsql;
using Yavsc.Model;
namespace Yavsc
{
/// <summary>
/// ITCP npgsql provider.
/// </summary>
public class ITCPNpgsqlProvider : NpgsqlContentProvider
{
/* TODO
int NewProject(string name, string desc, string ownedId);
void AddDevRessource (int prjId, string userName);
int NewTask(int projectId, string name, string desc);
void SetProjectName(int projectId, string name);
void SetProjectDesc(int projectId, string desc);
void SetTaskName(int taskId, string name);
void SetStartDate(int taskId, DateTime d);
void SetEndDate(int taskId, DateTime d);
void SetTaskDesc(int taskId, string desc);
void NewRelease(int projectId, string Version);
*/
/// <summary>
/// Initializes a new instance of the <see cref="Yavsc.ITCPNpgsqlProvider"/> class.
/// </summary>
public ITCPNpgsqlProvider ()
{
}
/// <summary>
/// Gets the project info.
/// </summary>
/// <returns>The project info.</returns>
/// <param name="projectid">Projectid.</param>
public ProjectInfo GetProjectInfo(int projectid)
{
throw new NotImplementedException ();
}
/// <summary>
/// Searchs the project.
/// </summary>
/// <returns>The project.</returns>
/// <param name="pi">Pi.</param>
public ProjectInfo[] SearchProject(ProjectInfo pi)
{
throw new NotImplementedException ();
}
/// <summary>
/// News the task.
/// </summary>
/// <returns>The task.</returns>
/// <param name="projectId">Project identifier.</param>
/// <param name="name">Name.</param>
/// <param name="desc">Desc.</param>
public int NewTask (int projectId, string name, string desc)
{
throw new System.NotImplementedException ();
}
/// <summary>
/// Sets the name of the task.
/// </summary>
/// <param name="taskId">Task identifier.</param>
/// <param name="name">Name.</param>
public void SetTaskName (int taskId, string name)
{
throw new System.NotImplementedException ();
}
/// <summary>
/// Sets the start date.
/// </summary>
/// <param name="taskId">Task identifier.</param>
/// <param name="d">D.</param>
public void SetStartDate (int taskId, DateTime d)
{
throw new System.NotImplementedException ();
}
/// <summary>
/// Sets the end date.
/// </summary>
/// <param name="taskId">Task identifier.</param>
/// <param name="d">D.</param>
public void SetEndDate (int taskId, DateTime d)
{
throw new System.NotImplementedException ();
}
/// <summary>
/// Removes the project.
/// </summary>
/// <param name="prjId">Prj identifier.</param>
public void RemoveProject (int prjId)
{
using (var cnx = CreateConnection()) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
cmd.CommandText = "delete from projets where id = @id";
cmd.Parameters.AddWithValue ("@id", prjId);
cmd.ExecuteNonQuery();
}
cnx.Close ();
}
}
/// <summary>
/// News the project.
/// </summary>
/// <returns>The project.</returns>
/// <param name="name">Name.</param>
/// <param name="desc">Desc.</param>
/// <param name="ownerId">Owner identifier.</param>
public int NewProject (string name, string desc, string ownerId)
{
int id = 0;
using (var cnx = CreateConnection()) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
cmd.CommandText = "insert into projets (name,managerid,ApplicatonName,prdesc) values (@name,@mid,@appname,@pdesc)";
cmd.Parameters.AddWithValue ("@name", name);
cmd.Parameters.AddWithValue ("@mid", ownerId);
cmd.Parameters.AddWithValue ("@appname", ApplicationName);
cmd.Parameters.AddWithValue ("@desc", desc);
id = (int)cmd.ExecuteScalar ();
}
cnx.Close ();
}
return id;
}
}
}

@ -1,103 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{9D7D892E-9B77-4713-892D-C26E1E944119}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>ITContentProvider</RootNamespace>
<AssemblyName>ITContentProvider</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<DocumentationFile>bin\Debug\ITContentProvider.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Lua|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Lua</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'TotemPre|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\TotemPre</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'TotemProd|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\TotemProd</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'YavscPre|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\YavscPre</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Yavsc|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Yavsc</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'LuaDebug|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Lua</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Configuration" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Web" />
<Reference Include="Npgsql">
<HintPath>..\packages\Npgsql.3.0.5\lib\net45\Npgsql.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ProjectInfo.cs" />
<Compile Include="ITCPNpgsqlProvider.cs" />
<Compile Include="Model\NewProjectModel.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\yavscModel\YavscModel.csproj">
<Project>{68F5B80A-616E-4C3C-91A0-828AA40000BD}</Project>
<Name>YavscModel</Name>
</ProjectReference>
<ProjectReference Include="..\NpgsqlContentProvider\NpgsqlContentProvider.csproj">
<Project>{821FF72D-9F4B-4A2C-B95C-7B965291F119}</Project>
<Name>NpgsqlContentProvider</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Model\" />
<Folder Include="Views\" />
<Folder Include="Views\Modules\" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Modules\IT\Index.aspx">
<DeployService-Deploy>True</DeployService-Deploy>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>

@ -1,38 +0,0 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
namespace Yavsc.Model
{
/// <summary>
/// New project model.
/// </summary>
public class NewProjectModel
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
[DisplayName("Nom du projet")]
[Required()]
public string Name { get; set; }
/// <summary>
/// Gets or sets the manager.
/// </summary>
/// <value>The manager.</value>
[DisplayName("Manager du projet")]
[Required]
public string Manager { get; set; }
/// <summary>
/// Gets or sets the description.
/// </summary>
/// <value>The description.</value>
[DisplayName("Description du projet")]
[Required]
public string Description { get; set; }
}
}

@ -1,53 +0,0 @@
using System;
using Yavsc;
namespace Yavsc.Model
{
/// <summary>
/// Project info.
/// </summary>
public class ProjectInfo
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
string Name { get; set; }
/// <summary>
/// Gets or sets the licence.
/// </summary>
/// <value>The licence.</value>
string Licence { get; set; }
/// <summary>
/// Gets or sets the BB description.
/// </summary>
/// <value>The BB description.</value>
string BBDescription { get; set; }
/// <summary>
/// Gets or sets the start date.
/// </summary>
/// <value>The start date.</value>
DateTime StartDate { get; set; }
/// <summary>
/// Gets or sets the prod version.
/// </summary>
/// <value>The prod version.</value>
string ProdVersion { get; set; }
/// <summary>
/// Gets or sets the stable version.
/// </summary>
/// <value>The stable version.</value>
string StableVersion { get; set; }
/// <summary>
/// Gets or sets the testing version.
/// </summary>
/// <value>The testing version.</value>
string TestingVersion { get; set; }
/// <summary>
/// Gets or sets the web site.
/// </summary>
/// <value>The web site.</value>
string WebSite { get; set; }
}
}

@ -1,22 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("ITContentProvider")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("Paul Schneider")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

@ -1,5 +0,0 @@
<%@ Page Title="Front office" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="MainContentContent" ContentPlaceHolderID="MainContent" runat="server">
</asp:Content>

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Npgsql" version="3.0.5" targetFramework="net451" />
</packages>

@ -1,124 +0,0 @@
VERSION=1.1
CONFIG=Debug
LDYDESTDIR=dist/web/$(CONFIG)
COPYUNCHANGED="false"
SHELL=/bin/bash
HOST_rsync_Debug=lua.pschneider.fr
DESTDIR_rsync_Debug=/srv/www/yavscdev
HOST_rsync_Release=lua.pschneider.fr
DESTDIR_rsync_Release=/srv/www/yavscpre
HOST_rsync_Lua=lua.pschneider.fr
DESTDIR_rsync_Lua=/srv/www/lua
HOST_rsync_LuaDebug=lua.pschneider.fr
DESTDIR_rsync_LuaDebug=/srv/www/lua
HOST_rsync_YavscPre=lua.pschneider.fr
DESTDIR_rsync_YavscPre=/srv/www/yavscpre
HOST_rsync_Yavsc=lua.pschneider.fr
DESTDIR_rsync_Yavsc=/srv/www/yavsc
HOST_rsync_TotemPre=lua.pschneider.fr
DESTDIR_rsync_TotemPre=/srv/www/totempre
HOST_rsync_TotemProd=lua.pschneider.fr
DESTDIR_rsync_TotemProd=/srv/www/totemprod
DOCASSBS=NpgsqlBlogProvider.dll WorkFlowProvider.dll Yavsc.WebControls.dll ITContentProvider.dll NpgsqlMRPProviders.dll Yavsc.dll SalesCatalog.dll YavscModel.dll
RSYNCCMD=rsync -ravu --chown=www-data:www-data
all: deploy
ddir:
mkdir -p $(LDYDESTDIR)
.PHONY: build
build :
echo "Building $(CONFIG) ..."
xbuild /p:Configuration=$(CONFIG) /t:Build Yavsc.sln
.PHONY: deploy
deploy: ddir build
rm -rf $(LYDESTDIR)
xbuild /p:Configuration=$(CONFIG) /p:SkipCopyUnchangedFiles=$(COPYUNCHANGED) /p:DeployDir=../$(LDYDESTDIR) /t:Deploy web/Yavsc.csproj
build_%: CONFIG = "$(subst build_,,$@)"
build_%: echo "Building $(CONFIG) ..."
xbuild /p:Configuration=$(CONFIG) /t:Build Yavsc.sln
rsync_% : CONFIG = $(subst rsync_,,$@)
rsync_% : HOST = $(HOST_rsync_$(CONFIG))
rsync_% : DESTDIR = $(DESTDIR_rsync_$(CONFIG))
rsync_% :
make deploy CONFIG=$(CONFIG)
if [[ "x$(HOST)" == "x" ]]; then echo "no host given, aborting"; exit 1; fi
echo "!Deploying to $(HOST) using $(CONFIG) config!"
$(RSYNCCMD) dist/web/$(CONFIG)/ root@$(HOST):$(DESTDIR)
clean:
xbuild /p:Configuration=$(CONFIG) /t:Clean Yavsc.sln
find -name "StyleCop.Cache" -exec rm {} \;
distclean: clean
rm -rf $(LDYDESTDIR)
sourcepkg:
git archive --format=tar --prefix=yavsc-$(CONFIG)/ $(CONFIG) | bzip2 > yavsc-$(CONFIG).tar.bz2
dist/web/$(CONFIG)/Web.config: deploy
web/Web.config: dist/web/$(CONFIG)/Web.config
cp dist/web/$(CONFIG)/Web.config web
start_xsp: build web/Web.config
(cd web; export MONO_OPTIONS=--debug; xsp4 --port 8080)
xmldoc: $(patsubst %,web/bin/%,$(DOCASSBS))
mdoc-update $^ $(patsubst %.dll,-i%.xml,$^) --out web/xmldoc
htmldoc: xmldoc
(cd web; monodocs2html -o htmldoc xmldoc)
docdeploy-prod: htmldoc
rsync -ravu web/htmldoc root@$(PRODHOSTDIR)
rsync_Lua:
rsync_LuaDebug:
rsync_Debug:
rsync_Release:
rsync_YavscPre:
rsync_yavsc:
rsync_Totemprod:
nuget_restore:
for prj in ITContentProvider NpgsqlBlogProvider NpgsqlContentProvider NpgsqlMRPProviders Presta SalesCatalog TestAPI web WebControls yavscclient yavscModel; do if [ -f "$${prj}/packages.config" ]; then nuget restore "$${prj}/packages.config" -SolutionDirectory . ; fi; done
nuget_update:
for prj in ITContentProvider NpgsqlBlogProvider NpgsqlContentProvider NpgsqlMRPProviders Presta SalesCatalog TestAPI web WebControls yavscclient yavscModel; do nuget update "$${prj}/packages.config" ; done
syncall: rsync_Debug rsync_Release rsync_YavscPre rsync_Lua rsync_Yavsc rsync_TotemPre rsync_TotemProd

@ -1,27 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("NpgsqlBlogProvider")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("paul")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

@ -1,836 +0,0 @@
using System;
using System.Configuration;
using System.Configuration.Provider;
using Npgsql;
using System.Collections.Generic;
using Yavsc.Model.Blogs;
using Yavsc.Model.Circles;
using NpgsqlTypes;
using System.Linq;
namespace Npgsql.Web.Blog
{
/// <summary>
/// Npgsql blog provider.
/// </summary>
public class NpgsqlBlogProvider : BlogProvider
{
string applicationName;
string connectionString;
#region implemented abstract members of BlogProvider
/// <summary>
/// Gets the public post count.
/// </summary>
/// <returns>The public post count.</returns>
/// <param name="bloggerName">Blogger name.</param>
public override long GetPublicPostCount (string bloggerName)
{
long result = -1;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = @"
Select count(*)
FROM blog b
LEFT OUTER JOIN blog_access a ON a.post_id = b._id
WHERE a.post_id IS NULL
AND b.visible = TRUE
AND b.username = :bname
AND b.applicationname = :app
";
cmd.Parameters.AddWithValue ("bname", bloggerName);
cmd.Parameters.AddWithValue ("app", applicationName);
cnx.Open ();
result = (long) cmd.ExecuteScalar ();
cnx.Close ();
}
return result;
}
/// <summary>
/// Updates the post.
/// </summary>
/// <param name="be">Be.</param>
public override void UpdatePost (BlogEntry be)
{
// TODO Tags and rate should not be ignored
UpdatePost (be.Id, be.Title, be.Content, be.Visible, be.AllowedCircles);
}
/// <summary>
/// Note the specified postid and note.
/// </summary>
/// <param name="postid">Postid.</param>
/// <param name="rate">rate.</param>
public override void Rate (long postid, int rate)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "update blog set rate = :rate where _id = :pid";
cmd.Parameters.AddWithValue ("rate", rate);
cmd.Parameters.AddWithValue ("pid", postid);
cnx.Open ();
cmd.ExecuteNonQuery ();
cnx.Close ();
}
}
/// <summary>
/// Tag the specified post by identifier
/// using the given tag.
/// </summary>
/// <param name="postid">Postid.</param>
/// <param name="tagname">Tag name.</param>
public override long Tag (long postid, string tagname)
{
long tid = GetOrCreateTagId (tagname);
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "INSERT INTO tagged (tagid,postid) VALUES (:tid,:pid)";
cmd.Parameters.AddWithValue ("tid", tid);
cmd.Parameters.AddWithValue ("pid", postid);
cnx.Open ();
cmd.ExecuteNonQuery ();
return tid;
}
}
/// <summary>
/// Uns the tag.
/// </summary>
/// <param name="postid">Postid.</param>
/// <param name="tagid">Tagid.</param>
/// <param name="name">Name.</param>
override public void Untag (long postid, string name)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "DELETE FROM tagged WHERE tagged.postid = :pid AND tagged.tagid = (select tag._id FROM tag WHERE tag.name = :tnm)";
cmd.Parameters.AddWithValue ("pid", postid);
cmd.Parameters.AddWithValue ("tnm", name);
cnx.Open ();
cmd.ExecuteNonQuery ();
}
}
/// <summary>
/// Uns the tag.
/// </summary>
/// <param name="postid">Postid.</param>
/// <param name="tagid">Tagid.</param>
/// <param name="tid">Tid.</param>
override public void Untag (long postid, long tid)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "DELETE FROM tagged WHERE postid = :pid AND tagid = :tid";
cmd.Parameters.AddWithValue ("pid", postid);
cmd.Parameters.AddWithValue ("tid", tid);
cnx.Open ();
cmd.ExecuteNonQuery ();
}
}
/// <summary>
/// Gets the comments.
/// </summary>
/// <returns>The comments.</returns>
/// <param name="postid">Postid.</param>
/// <param name="getHidden">If set to <c>true</c> get hidden.</param>
public override Comment[] GetComments (long postid, bool getHidden)
{
List<Comment> cmts = new List<Comment> ();
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select _id, username, bcontent, modified, posted, visible from comment " +
"where applicationname = :appname and postid = :id" +
((getHidden) ? " and visible = true " : " ") +
"order by posted asc";
cmd.Parameters.AddWithValue ("appname", applicationName);
cmd.Parameters.AddWithValue ("id", postid);
cnx.Open ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
while (rdr.Read ()) {
Comment c = new Comment ();
c.CommentText = rdr.GetString (rdr.GetOrdinal ("bcontent"));
c.From = rdr.GetString (rdr.GetOrdinal ("username"));
c.Modified = rdr.GetDateTime (rdr.GetOrdinal ("modified"));
c.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted"));
c.Visible = rdr.GetBoolean (rdr.GetOrdinal ("visible"));
c.PostId = postid;
c.Id = rdr.GetInt64 (rdr.GetOrdinal ("_id"));
cmts.Add (c);
}
}
}
return cmts.ToArray ();
}
/// <summary>
/// Updates the post.
/// </summary>
/// <param name="postid">Postid.</param>
/// <param name="title">Title.</param>
/// <param name="content">Content.</param>
/// <param name="visible">If set to <c>true</c> visible.</param>
/// <param name="cids">Circle identifiers</param>
public override void UpdatePost (long postid, string title, string content,
bool visible, long[] cids)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
DateTime now = DateTime.Now;
cmd.CommandText =
"update blog set modified=:now," +
" title = :title," +
" bcontent = :content, " +
" visible = :visible " +
"where _id = :id";
cmd.Parameters.AddWithValue ("now", now);
cmd.Parameters.AddWithValue ("title", title);
if (content == null)
content = "";
cmd.Parameters.AddWithValue ("content", content);
cmd.Parameters.AddWithValue ("visible", visible);
cmd.Parameters.AddWithValue ("id", postid);
cnx.Open ();
cmd.ExecuteNonQuery ();
}
cnx.Close ();
}
if (cids != null) UpdatePostCircles (postid, cids);
}
/// <summary>
/// Removes the post.
/// </summary>
/// <param name="postid">Postid.</param>
public override void RemovePost (long postid)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "delete from blog where _id = :id";
cmd.Parameters.AddWithValue ("id", postid);
cnx.Open ();
cmd.ExecuteNonQuery ();
}
}
/// <summary>
/// Comment the specified from, postid and content.
/// </summary>
/// <param name="from">From.</param>
/// <param name="postid">Postid.</param>
/// <param name="content">Content.</param>
public override long Comment (string from, long postid, string content)
{
if (from == null)
throw new ArgumentNullException ("from");
if (content == null)
throw new ArgumentNullException ("content");
bool visible = AutoValidatesComments;
using (NpgsqlConnection cnx =
new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "insert into comment (postid,bcontent," +
"modified,posted,visible,username,applicationname)" +
"values (:postid,:bcontent,:modified,:posted," +
":visible,:username,:appname) returning _id";
cmd.Parameters.AddWithValue ("postid", postid);
cmd.Parameters.AddWithValue ("bcontent", content);
DateTime now = DateTime.Now;
cmd.Parameters.AddWithValue ("modified", now);
cmd.Parameters.AddWithValue ("posted", now);
cmd.Parameters.AddWithValue ("visible", visible);
cmd.Parameters.AddWithValue ("username", from);
cmd.Parameters.AddWithValue ("appname", applicationName);
cnx.Open ();
return (long)cmd.ExecuteScalar ();
}
}
/// <summary>
/// Validates the comment.
/// </summary>
/// <param name="cmtid">Cmtid.</param>
public override void ValidateComment (long cmtid)
{
throw new NotImplementedException ();
}
/// <summary>
/// Updates the comment.
/// </summary>
/// <param name="cmtid">Cmtid.</param>
/// <param name="content">Content.</param>
/// <param name="visible">If set to <c>true</c> visible.</param>
public override void UpdateComment
(long cmtid, string content, bool visible)
{
throw new NotImplementedException ();
}
private bool autoValidateComment = true;
/// <summary>
/// Gets or sets a value indicating whether this <see cref="Npgsql.Web.Blog.NpgsqlBlogProvider"/> auto validate comment.
/// </summary>
/// <value><c>true</c> if auto validate comment; otherwise, <c>false</c>.</value>
public override bool AutoValidatesComments {
get {
return autoValidateComment;
}
set {
autoValidateComment = value;
}
}
/// <summary>
/// Blogs the title.
/// </summary>
/// <returns>The title.</returns>
/// <param name="username">Username.</param>
public override string BlogTitle
(string username)
{
throw new NotImplementedException ();
}
#endregion
/// <summary>
/// Initialize the specified name and config.
/// </summary>
/// <param name="name">Name.</param>
/// <param name="config">Config.</param>
public override void Initialize
(string name, System.Collections.Specialized.NameValueCollection config)
{
string cnxName = config ["connectionStringName"];
connectionString = ConfigurationManager.ConnectionStrings [cnxName].ConnectionString;
config.Remove ("connectionStringName");
applicationName = config ["applicationName"];
config.Remove ("applicationName");
defaultPageSize = int.Parse (config ["pageLen"] ?? "10");
base.Initialize (name, config);
}
#region implemented abstract members of BlogProvider
/// <summary>
/// Gets the post.
/// </summary>
/// <returns>The post.</returns>
/// <param name="postid">Postid.</param>
public override BlogEntry GetPost (long postid)
{
BlogEntry be = null;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select username, title, bcontent, modified, " +
"posted, visible, photo, rate from blog " +
"where applicationname = :appname and _id = :id";
cmd.Parameters.AddWithValue ("appname", applicationName);
cmd.Parameters.AddWithValue ("id", postid);
cnx.Open ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
if (rdr.Read ()) {
be = new BlogEntry ();
be.Title = rdr.GetString (rdr.GetOrdinal ("title"));
be.Content = rdr.GetString (rdr.GetOrdinal ("bcontent"));
be.Author = rdr.GetString (rdr.GetOrdinal ("username"));
be.Modified = rdr.GetDateTime (rdr.GetOrdinal ("modified"));
be.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted"));
be.Visible = rdr.GetBoolean (rdr.GetOrdinal ("visible"));
be.Rate = rdr.GetInt32 (rdr.GetOrdinal ("rate"));
int oph = rdr.GetOrdinal ("photo");
if (!rdr.IsDBNull (oph))
be.Photo = rdr.GetString (oph);
be.Id = postid;
}
}
}
if (be != null)
Populate (be);
return be;
}
/// <summary>
/// Removes the comment.
/// </summary>
/// <returns>The comment.</returns>
/// <param name="cmtid">Cmtid.</param>
public override long RemoveComment (long cmtid)
{
long postid = 0;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "delete from comment where _id = :id returning postid";
cmd.Parameters.AddWithValue ("id", cmtid);
cnx.Open ();
postid = (long)cmd.ExecuteScalar ();
}
return postid;
}
/// <summary>
/// Gets the post.
/// </summary>
/// <returns>The post.</returns>
/// <param name="username">Username.</param>
/// <param name="title">Title.</param>
public override UUTBlogEntryCollection GetPost (string username, string title)
{
UUTBlogEntryCollection bec = new UUTBlogEntryCollection (username, title);
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select _id,bcontent,modified,posted,visible,photo,rate from blog " +
"where applicationname = :appname and username = :username and title = :title order by rate desc";
cmd.Parameters.AddWithValue ("appname", NpgsqlDbType.Varchar, applicationName);
cmd.Parameters.AddWithValue ("username", NpgsqlDbType.Varchar, username);
cmd.Parameters.AddWithValue ("title", NpgsqlDbType.Varchar, title);
cnx.Open ();
cmd.Prepare ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
while (rdr.Read ()) {
BlogEntry be = new BlogEntry ();
be.Title = title;
be.Content = rdr.GetString (rdr.GetOrdinal ("bcontent"));
be.Author = username;
be.Modified = rdr.GetDateTime (rdr.GetOrdinal ("modified"));
be.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted"));
be.Visible = rdr.GetBoolean (rdr.GetOrdinal ("visible"));
be.Rate = rdr.GetInt32 (rdr.GetOrdinal ("rate"));
be.Id = rdr.GetInt64 (rdr.GetOrdinal ("_id"));
{
int oph = rdr.GetOrdinal ("photo");
if (!rdr.IsDBNull (oph))
be.Photo = rdr.GetString (oph);
}
bec.Add (be);
}
rdr.Close ();
}
}
if (bec.Count != 0) {
Populate (bec);
}
}
return bec;
}
private void SetCirclesOn (BasePost be)
{
List<long> circles = new List<long> ();
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmdcircles = cnx.CreateCommand ()) {
cmdcircles.CommandText = "select a.circle_id from blog_access a " +
"where a.post_id = :pid";
cmdcircles.Parameters.AddWithValue ("pid", be.Id);
cnx.Open ();
using (NpgsqlDataReader rdr = cmdcircles.ExecuteReader ()) {
while (rdr.Read ()) {
circles.Add (rdr.GetInt64 (0));
}
}
}
be.AllowedCircles = circles.ToArray ();
}
/// <summary>
/// Removes the tag.
/// </summary>
/// <param name="tagid">Tagid.</param>
public override void DropTag (long tagid)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "DELETE from public.tag where _id = :tid";
cmd.Parameters.AddWithValue ("tagid", tagid);
cnx.Open ();
cmd.ExecuteNonQuery ();
cnx.Close ();
}
}
private static string SelectTagsSql = "SELECT tag.name, tag._id FROM public.tag WHERE name like :name";
private IEnumerable<string> GetSuggestion (string pattern)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = SelectTagsSql;
throw new NotImplementedException ();
}
}
private static string InsertTagSql = "INSERT INTO tag (name) VALUES (:name) returning _id";
private void InsertTag (long postid, long tagid)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = InsertTagSql;
throw new NotImplementedException ();
}
}
private long GetTagId (string tagname)
{
// FIXME null pointer at cmd.ExecuteScalar!
if (tagname == null)
throw new NullReferenceException ("This tag name is null");
long id = 0;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "SELECT _id FROM tag WHERE name LIKE :tn";
cmd.Parameters.AddWithValue ("tn",NpgsqlDbType.Varchar, tagname);
id = (long) cmd.ExecuteScalar ();
}
cnx.Close ();
}
return id;
}
private long GetOrCreateTagId (string tagname)
{
if (tagname == null)
throw new NullReferenceException ("This tag name is null");
long id = 0;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
try {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "SELECT tag._id FROM public.tag WHERE name = :name";
cmd.Parameters.AddWithValue ("name", tagname);
cnx.Open ();
id = (long)cmd.ExecuteScalar ();
}
} catch (NullReferenceException) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "INSERT INTO public.tag(name) VALUES (:name) RETURNING _id";
cmd.Parameters.AddWithValue ("name", tagname);
id = (long)cmd.ExecuteScalar ();
}
}
}
return id;
}
private static string SelectPostTagsSql = "SELECT tag.name FROM public.tag, public.tagged\n" +
"WHERE tag._id = tagged.tagid AND tagged.postid = :pid \n";
private void SetTagsOn (BlogEntryCollection bec)
{
foreach (BlogEntry be in bec) {
SetTagsOn (be);
}
}
private void SetTagsOn (BasePost be)
{
List<string> tags = new List<string> ();
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmdtags = cnx.CreateCommand ()) {
cmdtags.CommandText = SelectPostTagsSql;
cmdtags.Parameters.AddWithValue ("pid", be.Id);
cnx.Open ();
using (NpgsqlDataReader rdr = cmdtags.ExecuteReader ()) {
while (rdr.Read ()) {
tags.Add (rdr.GetString (0));
}
}
}
be.Tags = tags.ToArray ();
}
// Assert(bec!=null);
private void Populate (BlogEntryCollection bec)
{
foreach (BlogEntry be in bec)
Populate (be);
}
private void Populate (BasePost be)
{
SetTagsOn (be);
SetCirclesOn (be);
}
/// <summary>
/// Post the specified username, title, content and visible.
/// </summary>
/// <param name="username">Username.</param>
/// <param name="title">Title.</param>
/// <param name="content">Content.</param>
/// <param name="visible">If set to <c>true</c> visible.</param>
/// <param name="circles">.</param>
public override long Post (string username, string title, string content, bool visible, long[] circles)
{
long pid = 0;
if (username == null)
throw new ArgumentNullException ("username");
if (title == null)
throw new ArgumentNullException ("title");
if (content == null)
content = "";
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "insert into blog (title,bcontent,modified,posted,visible,username,applicationname)" +
"values (:title,:bcontent,:modified,:posted,:visible,:username,:appname) returning _id";
cmd.Parameters.AddWithValue ("title", title);
cmd.Parameters.AddWithValue ("bcontent", content);
DateTime now = DateTime.Now;
cmd.Parameters.AddWithValue ("modified", now);
cmd.Parameters.AddWithValue ("posted", now);
cmd.Parameters.AddWithValue ("visible", visible);
cmd.Parameters.AddWithValue ("username", username);
cmd.Parameters.AddWithValue ("appname", applicationName);
cnx.Open ();
pid = (long)cmd.ExecuteScalar ();
}
cnx.Close ();
}
if (circles != null)
UpdatePostCircles (pid, circles);
return pid;
}
/// <summary>
/// Updates the post photo.
/// </summary>
/// <param name="pid">Pid.</param>
/// <param name="photo">Photo.</param>
public override void UpdatePostPhoto (long pid, string photo)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
if (photo == null)
cmd.CommandText = "update blog set photo = NULL where _id = :pid";
else {
cmd.CommandText = "update blog set photo = :photo where _id = :pid";
cmd.Parameters.AddWithValue ("photo", photo);
}
cmd.Parameters.AddWithValue ("pid", pid);
cmd.ExecuteNonQuery ();
}
cnx.Close ();
}
}
private void UpdatePostCircles (long pid, long[] circles)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "delete from blog_access where post_id = :pid";
cmd.Parameters.AddWithValue ("pid", pid);
cmd.ExecuteNonQuery ();
}
if (circles != null)
if (circles.Length > 0)
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "insert into blog_access (post_id,circle_id) values (:pid,:cid)";
cmd.Parameters.AddWithValue ("pid", NpgsqlTypes.NpgsqlDbType.Bigint, pid);
cmd.Parameters.Add ("cid", NpgsqlTypes.NpgsqlDbType.Bigint);
cmd.Prepare ();
foreach (long ci in circles) {
cmd.Parameters ["cid"].Value = ci;
cmd.ExecuteNonQuery ();
}
}
cnx.Close ();
}
}
/// <summary>
/// Finds the post.
/// </summary>
/// <returns>The post.</returns>
/// <param name="readersName">Reader's Name.</param>
/// <param name="pattern">Pattern.</param>
/// <param name="searchflags">Searchflags.</param>
/// <param name="pageIndex">Page index.</param>
/// <param name="pageSize">Page size.</param>
/// <param name="totalRecords">Total records.</param>
public override BlogEntryCollection FindPost (string readersName, string pattern, FindBlogEntryFlags searchflags, int pageIndex, int pageSize, out int totalRecords)
{
BlogEntryCollection c = new BlogEntryCollection ();
totalRecords = 0;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
if (readersName != null) {
cmd.CommandText = "select _id, title,bcontent, modified," +
"posted,username,visible,photo,rate " +
"from blog b left outer join " +
"(select count(*)>0 acc, a.post_id pid " +
"from blog_access a," +
" circle_members m, users u where m.circle_id = a.circle_id " +
" and m.member = u.username and u.username = :uname " +
" and u.applicationname = :appname " +
" group by a.post_id) ma on (ma.pid = b._id) " +
"where ( ((ma.acc IS NULL or ma.acc = TRUE) and b.Visible IS TRUE ) or b.username = :uname) ";
cmd.Parameters.AddWithValue ("uname", readersName);
} else {
cmd.CommandText = "select _id, title,bcontent,modified," +
"posted,username,visible,photo,rate " +
"from blog b left outer join " +
"(select count(*)>0 acc, a.post_id pid " +
"from blog_access a" +
" group by a.post_id) ma on (ma.pid = b._id)" +
" where " +
" ( ma.acc IS NULL and " +
" b.Visible IS TRUE and " +
" applicationname = :appname ) ";
}
cmd.Parameters.AddWithValue ("appname", applicationName);
if (pattern != null) {
if ((searchflags & FindBlogEntryFlags.MatchTag) > 0) {
cmd.CommandText +=
" AND EXISTS (SELECT tag._id FROM tag, tagged \n" +
" WHERE tag._id = tagged.tagid \n" +
" AND tagged.postid = b._id \n" +
" AND tag.name like :tagname) \n";
cmd.Parameters.AddWithValue ("tagname", pattern);
}
if ((searchflags & FindBlogEntryFlags.MatchContent) > 0) {
cmd.CommandText += " and bcontent like :bcontent \n";
cmd.Parameters.AddWithValue ("bcontent", pattern);
}
if ((searchflags & FindBlogEntryFlags.MatchTitle) > 0) {
cmd.CommandText += " and title like :title";
cmd.Parameters.AddWithValue ("title", pattern);
}
if ((searchflags & FindBlogEntryFlags.MatchUserName) > 0) {
cmd.CommandText += " and username like :username \n";
cmd.Parameters.AddWithValue ("username", pattern);
}
}
if (((searchflags & FindBlogEntryFlags.MatchInvisible) == 0) &&
(readersName == null) ) {
cmd.CommandText += " and visible = true \n";
}
cmd.CommandText += " order by rate desc";
cnx.Open ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
// pageIndex became one based
int firstrec = pageIndex * pageSize;
int lastrec = firstrec + pageSize - 1;
while (rdr.Read ()) {
if (totalRecords >= firstrec && totalRecords <= lastrec) {
BlogEntry be = new BlogEntry ();
be.Title = rdr.GetString (rdr.GetOrdinal ("title"));
be.Id = rdr.GetInt64 (rdr.GetOrdinal ("_id"));
be.Content = rdr.GetString (rdr.GetOrdinal ("bcontent"));
be.Author = rdr.GetString (rdr.GetOrdinal ("username"));
be.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted"));
be.Modified = rdr.GetDateTime (rdr.GetOrdinal ("modified"));
be.Visible = rdr.GetBoolean (rdr.GetOrdinal ("visible"));
be.Rate = rdr.GetInt32 (rdr.GetOrdinal ("rate"));
{
int oph = rdr.GetOrdinal ("photo");
if (!rdr.IsDBNull (oph))
be.Photo = rdr.GetString (oph);
}
c.Add (be);
}
totalRecords++;
}
rdr.Close ();
}
}
if (c != null)
Populate (c);
return c;
}
/// <summary>
/// Removes the post.
/// </summary>
/// <param name="username">Username.</param>
/// <param name="title">Title.</param>
public override void RemoveTitle (string username, string title)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "delete from blog where username = :username and applicationname = :appname and title=:title";
cmd.Parameters.AddWithValue ("username", username);
cmd.Parameters.AddWithValue ("appname", applicationName);
cmd.Parameters.AddWithValue ("title", title);
cnx.Open ();
cmd.ExecuteNonQuery ();
cnx.Close ();
}
}
int defaultPageSize = 10;
/// <summary>
/// Lasts the posts.
/// </summary>
/// <returns>The posts.</returns>
/// <param name="pageIndex">Page index.</param>
/// <param name="pageSize">Page size.</param>
/// <param name="totalRecords">Total records.</param>
public override BlogEntryCollection LastPosts (int pageIndex, int pageSize, out int totalRecords)
{
BlogEntryCollection c = new BlogEntryCollection ();
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select * " +
"from blog where applicationname = :appname and visible = true " +
" order by modified desc limit :len";
cmd.Parameters.AddWithValue ("appname", applicationName);
cmd.Parameters.AddWithValue ("len", defaultPageSize * 10);
cnx.Open ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
totalRecords = 0;
int firstrec = pageIndex * pageSize;
int lastrec = firstrec + pageSize - 1;
while (rdr.Read ()) {
if (totalRecords >= firstrec && totalRecords <= lastrec) {
BlogEntry be = new BlogEntry ();
be.Id = rdr.GetInt64 (rdr.GetOrdinal ("_id"));
be.Title = rdr.GetString (rdr.GetOrdinal ("title"));
be.Content = rdr.GetString (rdr.GetOrdinal ("bcontent"));
be.Author = rdr.GetString (rdr.GetOrdinal ("username"));
be.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted"));
be.Modified = rdr.GetDateTime (rdr.GetOrdinal ("modified"));
be.Visible = true; // because of sql code used
be.Rate = rdr.GetInt32(rdr.GetOrdinal("rate"));
{
int oph = rdr.GetOrdinal ("photo");
if (!rdr.IsDBNull (oph))
be.Photo = rdr.GetString (oph);
}
SetTagsOn (be);
SetCirclesOn (be);
c.Add (be);
}
totalRecords++;
}
}
}
if (c != null)
Populate (c);
return c;
}
#endregion
}
}

@ -1,99 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{C6E9E91B-97D3-48D9-8AA7-05356929E162}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Npgsql.Web.Blog</RootNamespace>
<AssemblyName>NpgsqlBlogProvider</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<DocumentationFile>bin\Debug\NpgsqlBlogProvider.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Lua|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Lua</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'TotemPre|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\TotemPre</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'TotemProd|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\TotemProd</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'YavscPre|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\YavscPre</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Yavsc|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Yavsc</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'LuaDebug|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Lua</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Compile Include="NpgsqlBlogProvider.cs" />
<Compile Include="AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Sql\" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Configuration" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="Npgsql">
<HintPath>..\packages\Npgsql.3.0.5\lib\net45\Npgsql.dll</HintPath>
</Reference>
</ItemGroup>
<ProjectExtensions>
<MonoDevelop>
<Properties>
<Policies>
<DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedFlat" ResourceNamePolicy="FileFormatDefault" />
</Policies>
</Properties>
</MonoDevelop>
</ProjectExtensions>
<ItemGroup>
<None Include="Sql\BlogTable.sql" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\yavscModel\YavscModel.csproj">
<Project>{68F5B80A-616E-4C3C-91A0-828AA40000BD}</Project>
<Name>YavscModel</Name>
</ProjectReference>
</ItemGroup>
</Project>

@ -1,21 +0,0 @@
-- Table: blog
-- DROP TABLE blog;
CREATE TABLE blog
(
applicationname character varying(255) NOT NULL,
username character varying(255) NOT NULL,
posted timestamp with time zone NOT NULL,
modified timestamp with time zone NOT NULL,
title character varying(255) NOT NULL,
bcontent text NOT NULL,
CONSTRAINT pk_blog PRIMARY KEY (username , applicationname , title ),
CONSTRAINT bloguser FOREIGN KEY (applicationname, username)
REFERENCES users (applicationname, username) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE
)
WITH (
OIDS=FALSE
);

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Npgsql" version="3.0.5" targetFramework="net451" />
</packages>

@ -1,372 +0,0 @@
//
// NpgsqlCircleProvider.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Configuration;
using System.Web.Security;
using Npgsql;
using NpgsqlTypes;
using Yavsc.Model;
using Yavsc.Model.Circles;
namespace WorkFlowProvider
{
/// <summary>
/// Npgsql circle provider.
/// </summary>
public class NpgsqlCircleProvider : CircleProvider
{
#region implemented abstract members of CircleProvider
/// <summary>
/// Circles the specified ownername and username.
/// </summary>
/// <param name="ownername">Ownername.</param>
/// <param name="username">Username.</param>
public override string[] Circles (string ownername, string username)
{
List<string> circles = new List<string> ();
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = @"select c.title from circle c, circle_members m
where c.owner = :wnr
and c._id = m.circle_id
and m.member = :user
and m.applicationname = :app
";
cmd.Parameters.AddWithValue ("wnr",ownername);
cmd.Parameters.AddWithValue ("user",username);
cmd.Parameters.AddWithValue ("app",applicationName);
cnx.Open ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
if (rdr.HasRows) while (rdr.Read ())
circles.Add (rdr.GetString (0));
rdr.Close ();
}
}
cnx.Close ();
}
return circles.ToArray();
}
/// <summary>
/// Updates the circle.
/// </summary>
/// <param name="c">C.</param>
public override void UpdateCircle (CircleBase c)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "update circle " +
"set title = :title " +
"where _id = :cid ";
cmd.Parameters.AddWithValue ("title", c.Title);
cmd.Parameters.AddWithValue ("cid", c.Id);
cmd.ExecuteNonQuery ();
}
cnx.Close ();
}
}
/// <summary>
/// Get the specified circle by id, including all of its members.
/// </summary>
/// <param name="id">Identifier.</param>
/// <returns>The members.</returns>
public override Circle GetMembers (long id)
{
Circle circ = null;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select title, owner, public from circle where _id = :cid";
cmd.Parameters.AddWithValue ("cid", id);
using (NpgsqlDataReader dr = cmd.ExecuteReader ()) {
if (dr.Read ()) {
circ = new Circle ();
circ.Id = id;
circ.Title = dr.GetString (
dr.GetOrdinal ("title"));
circ.Owner = dr.GetString (
dr.GetOrdinal ("owner"));
}
dr.Close ();
}
}
if (circ != null) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select member from circle_members where circle_id = :cid";
cmd.Parameters.AddWithValue ("cid", NpgsqlTypes.NpgsqlDbType.Bigint, id);
cmd.Prepare ();
List<string> members = new List<string> ();
using (NpgsqlDataReader dr = cmd.ExecuteReader ()) {
while (dr.Read ())
members.Add (dr.GetString (0));
dr.Close ();
circ.Members = members.ToArray ();
}
}
}
cnx.Close ();
}
return circ;
}
/// <summary>
/// Gets the identifier.
/// </summary>
/// <returns>The identifier.</returns>
/// <param name="circle">Circle.</param>
/// <param name="username">Username.</param>
public override long GetId (string circle, string username)
{
long cid = 0;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select _id from circle where " +
"owner = :uname " +
"and title = :title " +
"and applicationname = :appname";
cmd.Parameters.AddWithValue ("uname", username);
cmd.Parameters.AddWithValue ("title", circle);
cmd.Parameters.AddWithValue ("appname", applicationName);
cid = (long)cmd.ExecuteScalar ();
}
cnx.Close ();
}
return cid;
}
/// <summary>
/// Removes the membership.
/// </summary>
/// <param name="circle_id">Circle identifier.</param>
/// <param name="member">Member.</param>
public override void RemoveMembership (long circle_id, string member)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "delete from circle_members where circle_id = :cid and username = :uname";
cmd.Parameters.AddWithValue ("cid", circle_id);
cmd.Parameters.AddWithValue ("uname", member);
cnx.Open ();
cmd.ExecuteNonQuery ();
cnx.Close ();
}
}
/// <summary>
/// Removes the member from all current user circles.
/// </summary>
/// <param name="member">Member.</param>
public override void RemoveMember (string member)
{
throw new NotImplementedException ();
}
#endregion
/// <summary>
/// Initializes a new instance of the <see cref="WorkFlowProvider.NpgsqlCircleProvider"/> class.
/// </summary>
public NpgsqlCircleProvider ()
{
}
#region implemented abstract members of CircleProvider
/// <summary>
/// Returns circles from owner.
/// </summary>
/// <param name="circle_ids">Circle identifiers.</param>
/// <param name="member">Member name.</param>
public override bool Matches (long[] circle_ids, string member)
{
bool result = false;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select count(*)>0 from circle_members where circle_id = :cid and member = :mbr";
cmd.Parameters.Add ("cid", NpgsqlDbType.Bigint);
cmd.Parameters.AddWithValue ("mbr", NpgsqlDbType.Varchar, member);
cnx.Open ();
cmd.Prepare ();
foreach (long cid in circle_ids) {
result = (bool)cmd.ExecuteScalar ();
if (result)
break;
}
cnx.Close ();
}
return result;
}
/// <summary>
/// Add the specified user.
/// </summary>
/// <param name="id">circle Identifier.</param>
/// <param name="username">User name.</param>
public override void AddMember (long id, string username)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "insert into circle_members (circle_id, member) values (:cid,:uname)";
cmd.Parameters.AddWithValue ("cid", id);
cmd.Parameters.AddWithValue ("uname", username);
cnx.Open ();
cmd.ExecuteNonQuery ();
cnx.Close ();
}
}
/// <summary>
/// Get the specified circle by id.
/// </summary>
/// <param name="id">Identifier.</param>
public override CircleBase Get (long id)
{
CircleBase circ = null;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select title, owner from circle where _id = :cid";
cmd.Parameters.AddWithValue ("cid", id);
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
if (rdr.Read ()) {
circ = new CircleBase ();
circ.Id = id;
circ.Owner = rdr.GetString (1);
circ.Title = rdr.GetString (0);
}
}
}
cnx.Close ();
}
return circ;
}
/// <summary>
/// Add the specified owner, title and users.
/// </summary>
/// <param name="owner">Owner.</param>
/// <param name="title">Title.</param>
/// <param name="users">Users.</param>
public override long Create (string owner, string title, string[] users)
{
long id = 0;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "insert into circle (owner,title,applicationname,public) values (:wnr,:tit,:app,FALSE) returning _id";
cmd.Parameters.AddWithValue ("wnr", owner);
cmd.Parameters.AddWithValue ("tit", title);
cmd.Parameters.AddWithValue ("app", applicationName);
id = (long)cmd.ExecuteScalar ();
}
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "insert into circle_members (circle_id,member) values (@cid,@mbr)";
cmd.Parameters.AddWithValue ("cid", NpgsqlDbType.Bigint , id);
cmd.Parameters.Add ("mbr", NpgsqlDbType.Varchar);
cmd.Prepare ();
if (users != null)
foreach (string user in users) {
cmd.Parameters [1].Value = user;
cmd.ExecuteNonQuery ();
}
}
cnx.Close ();
}
return id;
}
/// <summary>
/// Delete the specified title.
/// </summary>
/// <param name="id">Identifier.</param>
public override void Delete (long id)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "delete from circle where _id = @cid";
cmd.Parameters.AddWithValue ("cid", id);
cnx.Open ();
cmd.ExecuteNonQuery ();
cnx.Close ();
}
}
/// <summary>
/// List user's circles.
/// </summary>
/// <param name="user">User.</param>
public override IEnumerable<CircleBase> List (string user)
{
List<CircleBase> cc = new List<CircleBase> ();
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select _id, title from circle where owner = :wnr";
cmd.Parameters.AddWithValue ("wnr",user);
cnx.Open ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
if (rdr.HasRows) {
while (rdr.Read ()) {
CircleBase cb = new CircleBase ();
cb.Id = rdr.GetInt64 (0);
cb.Title = rdr.GetString (1);
cb.Owner = user;
cc.Add (cb);
}
}
rdr.Close ();
}
}
cnx.Close ();
}
return cc;
}
#endregion
string connectionString = null;
string applicationName = null;
/// <summary>
/// Initialize this object using the specified name and config.
/// </summary>
/// <param name="name">Name.</param>
/// <param name="config">Config.</param>
public override void Initialize (string name, NameValueCollection config)
{
if (string.IsNullOrWhiteSpace (config ["connectionStringName"]))
throw new ConfigurationErrorsException ("No name for Npgsql connection string found");
connectionString = ConfigurationManager.ConnectionStrings [config ["connectionStringName"]].ConnectionString;
applicationName = config ["applicationName"] ?? "/";
}
}
}

@ -1,753 +0,0 @@
using System;
using Npgsql;
using NpgsqlTypes;
using System.Configuration;
using System.Collections.Specialized;
using Yavsc.Model.WorkFlow;
using System.Configuration.Provider;
using System.Collections.Generic;
using Yavsc.Model.FrontOffice;
using System.Web.Security;
using System.Runtime.Serialization.Json;
using System.IO;
using System.Text;
using Newtonsoft.Json;
using Yavsc.Model.FrontOffice.Catalog;
namespace Yavsc
{
/// <summary>
/// Npgsql content provider.
/// </summary>
public class NpgsqlContentProvider: ProviderBase, IContentProvider
{
/// <summary>
/// Finds the performer.
/// </summary>
/// <returns>The performer.</returns>
/// <param name="MEACode">MEA code.</param>
public PerformerProfile[] FindPerformer (string MEACode)
{
var result = new List<PerformerProfile> ();
using (NpgsqlConnection cnx = CreateConnection ()) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = @"SELECT d.uniqueid, u.username, u.email, d.rate
FROM profiledata d, profiles p, users u
WHERE u.username = p.username
AND u.applicationname = p.applicationname
AND p.uniqueid = d.uniqueid
AND u.isapproved = TRUE
AND u.islockedout = FALSE
AND d.meacode = :mea
AND u.applicationname = :app
ORDER BY u.username ";
cmd.Parameters.AddWithValue ("mea", NpgsqlTypes.NpgsqlDbType.Varchar, MEACode);
cmd.Parameters.AddWithValue ("app", NpgsqlTypes.NpgsqlDbType.Varchar, applicationName);
using (var rdr = cmd.ExecuteReader ()) {
if (rdr.HasRows) {
while (rdr.Read ()) {
var profile = new PerformerProfile (rdr.GetString (1));
profile.Id = rdr.GetInt64 (0);
profile.EMail = rdr.GetString (2);
profile.MEACode = MEACode;
profile.Rate = rdr.GetInt32 (3);
result.Add (profile);
}
}
}
}
}
return result.ToArray ();
}
/// <summary>
/// Gets the activity.
/// </summary>
/// <returns>The activity.</returns>
/// <param name="MEACode">MEA code.</param>
public Activity GetActivity (string MEACode)
{
Activity result = null;
using (NpgsqlConnection cnx = CreateConnection ()) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = @"select distinct meacode, title, cmnt, photo
from activity where meacode = :code and applicationname = :app";
cmd.Parameters.AddWithValue ("code", MEACode);
cmd.Parameters.AddWithValue ("app", applicationName);
using (var rdr = cmd.ExecuteReader ()) {
if (rdr.HasRows) {
rdr.Read ();
result = new Activity () {
Id = rdr.GetString (0),
Title = rdr.GetString (1),
Comment = rdr.GetString (2),
Photo = rdr.GetString (3)
};
}
}
}
cnx.Close ();
}
return result;
}
/// <summary>
/// Finds the activity.
/// </summary>
/// <returns>The activity.</returns>
/// <param name="pattern">Pattern.</param>
/// <param name="exerted">If set to <c>true</c> exerted.</param>
public Activity[] FindActivity (string pattern, bool exerted)
{
List<Activity> acties = new List<Activity> ();
using (NpgsqlConnection cnx = CreateConnection ()) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = (exerted) ?
@"SELECT a.meacode, a.title, a.cmnt, a.photo
FROM activity a, profiledata d, profiles p, users u
WHERE u.username = p.username
AND u.applicationname = p.applicationname
AND p.uniqueid = d.uniqueid
AND d.meacode = a.meacode
AND u.isapproved = TRUE
AND u.islockedout = FALSE
AND a.title like :pat
ORDER BY a.meacode " :
@"SELECT meacode, title, cmnt, photo
FROM activity
WHERE title LIKE :pat
ORDER BY meacode ";
cmd.Parameters.AddWithValue ("pat", pattern);
using (var rdr = cmd.ExecuteReader ()) {
if (!rdr.HasRows)
return new Activity[0];
new List<Activity> ();
while (rdr.Read ()) {
acties.Add (new Activity () {
Id = rdr.GetString (0),
Title = rdr.GetString (1),
Comment = rdr.GetString (2),
Photo = rdr.GetString (3)
});
}
}
}
cnx.Close ();
}
return acties.ToArray();
}
/// <summary>
/// Registers the activity.
/// </summary>
/// <param name="activity">Activity.</param>
/// <param name="code">Code.</param>
public void RegisterActivity (string activity, string code, string comment)
{
using (NpgsqlConnection cnx = CreateConnection ()) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "insert into activity (meacode,title,applicationname,cmnt) " +
" values (:code,:title,:app,:cmnt)";
cmd.Parameters.AddWithValue ("code", code);
cmd.Parameters.AddWithValue ("title", activity);
cmd.Parameters.AddWithValue ("app", applicationName);
cmd.Parameters.AddWithValue ("cmnt", comment);
cmd.ExecuteNonQuery ();
}
cnx.Close ();
}
}
/// <summary>
/// Registers the command.
/// </summary>
/// <returns>The command id in db.</returns>
/// <param name="com">COM.</param>
public long RegisterCommand (Command com)
{
long id;
using (NpgsqlConnection cnx = CreateConnection ()) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText =
"insert into commandes (prdref,creation,params,class,clientname,applicationname) values (:pref,:creat,:prms,:cls,:cli,:app) returning id";
cmd.Parameters.AddWithValue ("pref", com.ProductRef);
cmd.Parameters.AddWithValue ("creat", com.CreationDate);
cmd.Parameters.AddWithValue ("prms", NpgsqlTypes.NpgsqlDbType.Jsonb,
JsonConvert.SerializeObject(
com.Parameters));
cmd.Parameters.AddWithValue ("cls", com.GetType().FullName);
cmd.Parameters.AddWithValue ("cli", com.ClientName);
cmd.Parameters.AddWithValue ("app", ApplicationName);
cnx.Open ();
com.Id = id = (long)cmd.ExecuteScalar ();
}
}
return id;
}
/// <summary>
/// Gets the commands.
/// </summary>
/// <returns>The commands.</returns>
/// <param name="username">Username.</param>
public CommandSet GetCommands (string username)
{
// Check the user's authorisations
MembershipUser user = Membership.GetUser ();
if (user.UserName != username)
if (!Roles.IsUserInRole ("Admin"))
if (!Roles.IsUserInRole ("FrontOffice"))
throw new Exception ("Not allowed");
CommandSet cmds = new CommandSet ();
using (NpgsqlConnection cnx = CreateConnection ()) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText =
"select id,creation,prdref,params::TEXT,class from commandes where @user = clientname and applicationname = @app";
cmd.Parameters.AddWithValue ("@user", username);
cmd.Parameters.AddWithValue ("@app", this.ApplicationName);
cnx.Open ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
while (rdr.Read ()) {
string cls = rdr.GetString (4);
Command ycmd = Command.CreateCommand(cls);
ycmd.Id = rdr.GetInt64 (0);
ycmd.CreationDate = rdr.GetDateTime (1);
ycmd.ProductRef = rdr.GetString (2);
ycmd.ClientName = username;
var prms = rdr.GetString (3);
var obj = JsonConvert.DeserializeObject<Dictionary<string,string>> (prms);
ycmd.SetParameters(obj as Dictionary<string,string>);
cmds.Add (ycmd);
}
}
}
cnx.Close ();
}
return cmds;
}
/// <summary>
/// Gets the stock status.
/// </summary>
/// <returns>The stock status.</returns>
/// <param name="productReference">Product reference.</param>
public virtual StockStatus GetStockStatus (string productReference)
{
return StockStatus.NonExistent;
}
/// <summary>
/// Gets the writting status changes.
/// </summary>
/// <returns>The writting statuses.</returns>
/// <param name="wrid">Wrid.</param>
public StatusChange[] GetWrittingStatuses (long wrid)
{
throw new NotImplementedException ();
}
/// <summary>
/// Gets the estimate status changes.
/// </summary>
/// <returns>The estimate statuses.</returns>
/// <param name="estid">Estid.</param>
public StatusChange[] GetEstimateStatuses (long estid)
{
throw new NotImplementedException ();
}
/// <summary>
/// Tags the writting.
/// </summary>
/// <param name="wrid">Wrid.</param>
/// <param name="tag">Tag.</param>
public void TagWritting (long wrid, string tag)
{
throw new NotImplementedException ();
}
/// <summary>
/// Drops the writting tag .
/// </summary>
/// <param name="wrid">Wrid.</param>
/// <param name="tag">Tag.</param>
public void DropWrittingTag (long wrid, string tag)
{
throw new NotImplementedException ();
}
/// <summary>
/// Sets the writting status.
/// </summary>
/// <param name="wrtid">Wrtid.</param>
/// <param name="status">Status.</param>
/// <param name="username">Username.</param>
public void SetWrittingStatus (long wrtid, int status, string username)
{
throw new NotImplementedException ();
}
/// <summary>
/// Sets the estimate status.
/// </summary>
/// <param name="estid">Estid.</param>
/// <param name="status">Status.</param>
/// <param name="username">Username.</param>
public void SetEstimateStatus (long estid, int status, string username)
{
throw new NotImplementedException ();
}
/// <summary>
/// Releases all resource used by the <see cref="Yavsc.NpgsqlContentProvider"/> object.
/// </summary>
/// <remarks>Call <see cref="Dispose"/> when you are finished using the <see cref="Yavsc.NpgsqlContentProvider"/>. The
/// <see cref="Dispose"/> method leaves the <see cref="Yavsc.NpgsqlContentProvider"/> in an unusable state. After
/// calling <see cref="Dispose"/>, you must release all references to the <see cref="Yavsc.NpgsqlContentProvider"/> so
/// the garbage collector can reclaim the memory that the <see cref="Yavsc.NpgsqlContentProvider"/> was occupying.</remarks>
public void Dispose ()
{
throw new NotImplementedException ();
}
/// <summary>
/// Install the model in database using the specified cnx.
/// </summary>
/// <param name="cnx">Cnx.</param>
public void Install (System.Data.IDbConnection cnx)
{
throw new NotImplementedException ();
}
/// <summary>
/// Uninstall the module data and data model from
/// database, using the specified connection.
/// </summary>
/// <param name="cnx">Cnx.</param>
/// <param name="removeConfig">If set to <c>true</c> remove config.</param>
public void Uninstall (System.Data.IDbConnection cnx, bool removeConfig)
{
throw new NotImplementedException ();
}
/// <summary>
/// Defaults the config.
/// </summary>
/// <returns>The config.</returns>
/// <param name="appName">App name.</param>
/// <param name="cnxStr">Cnx string.</param>
public ConfigurationSection DefaultConfig (string appName, string cnxStr)
{
throw new NotImplementedException ();
}
/// <summary>
/// Gets or sets a value indicating whether this <see cref="Yavsc.NpgsqlContentProvider"/> is active.
/// </summary>
/// <value><c>true</c> if active; otherwise, <c>false</c>.</value>
public bool Active {
get {
throw new NotImplementedException ();
}
set {
throw new NotImplementedException ();
}
}
/// <summary>
/// Gets the different status labels.
/// 0 is the starting status. Each status is an integer and the 0-based index
/// of a string in this array.
/// </summary>
/// <value>The status labels.</value>
public string[] Statuses {
get {
return new string[] { "Created", "Validated", "Success", "Error" };
}
}
/// <summary>
/// Gets the final statuses.
/// </summary>
/// <value>The final statuses.</value>
public bool[] FinalStatuses {
get {
return new bool[] { false, false, true, true };
}
}
/// <summary>
/// Gets the estimates created by
/// or for the given user by user name.
/// </summary>
/// <returns>The estimates.</returns>
/// <param name="username">user name.</param>
public Estimate[] GetEstimates (string username)
{
if (username == null)
throw new InvalidOperationException (
"username cannot be" +
" null at searching for estimates");
List<long> ids = new List<long> ();
List<Estimate> ests = new List<Estimate> ();
using (NpgsqlConnection cnx = CreateConnection ()) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText =
"select _id from estimate where client = @uname or username = @uname";
cmd.Parameters.AddWithValue ("@uname", username);
cnx.Open ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
while (rdr.Read ()) {
ids.Add (rdr.GetInt64 (0));
}
rdr.Close ();
}
cnx.Close ();
}
foreach (long id in ids)
ests.Add (Get (id));
return ests.ToArray ();
}
}
/// <summary>
/// Gets the estimates.
/// </summary>
/// <returns>The estimates.</returns>
/// <param name="client">Client.</param>
/// <param name="responsible">Responsible.</param>
public Estimate[] GetEstimates (string client, string responsible)
{
if (client == null && responsible == null)
throw new InvalidOperationException (
"client and responsible cannot be" +
" both null at searching for estimates");
List<long> ids = new List<long> ();
List<Estimate> ests = new List<Estimate> ();
using (NpgsqlConnection cnx = CreateConnection ()) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText =
"select _id from estimate where ";
if (client != null) {
cmd.CommandText += "client = @clid";
if (responsible != null)
cmd.CommandText += " and ";
cmd.Parameters.AddWithValue ("@clid", client);
}
if (responsible != null) {
cmd.CommandText += "username = @resp";
cmd.Parameters.AddWithValue ("@resp", responsible);
}
cnx.Open ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
while (rdr.Read ()) {
ids.Add (rdr.GetInt64 (0));
}
rdr.Close ();
}
foreach (long id in ids)
ests.Add (Get (id));
return ests.ToArray ();
}
}
}
/// <summary>
/// Drops the writting.
/// </summary>
/// <param name="wrid">Wrid.</param>
public void DropWritting (long wrid)
{
using (NpgsqlConnection cnx = CreateConnection ()) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText =
"delete from writtings where _id = @wrid";
cmd.Parameters.AddWithValue ("@wrid", wrid);
cnx.Open ();
cmd.ExecuteNonQuery ();
}
}
}
/// <summary>
/// Drops the estimate.
/// </summary>
/// <param name="estid">Estid.</param>
public void DropEstimate (long estid)
{
using (NpgsqlConnection cnx = CreateConnection ()) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText =
"delete from estimate where _id = @estid";
cmd.Parameters.AddWithValue ("@estid", estid);
cnx.Open ();
cmd.ExecuteNonQuery ();
}
}
}
/// <summary>
/// Gets the estimate by identifier.
/// </summary>
/// <returns>The estimate.</returns>
/// <param name="estimid">Estimid.</param>
public Estimate Get (long estimid)
{
Estimate est = null;
using (NpgsqlConnection cnx = CreateConnection ()) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText =
"select title,username,client,description from estimate where _id = @estid";
cmd.Parameters.AddWithValue ("@estid", estimid);
cnx.Open ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
if (!rdr.Read ()) {
return null;
}
est = new Estimate ();
est.Title = rdr.GetString (
rdr.GetOrdinal ("title"));
est.Responsible = rdr.GetString (
rdr.GetOrdinal ("username"));
int clientidx = rdr.GetOrdinal ("client");
if (!rdr.IsDBNull (clientidx))
est.Client = rdr.GetString (clientidx);
int index = rdr.GetOrdinal ("description");
if (!rdr.IsDBNull (index))
est.Description = rdr.GetString (index);
est.Id = estimid;
rdr.Close ();
}
}
// assert est != null
using (NpgsqlCommand cmdw = new NpgsqlCommand ("select _id, productid, ucost, count, description from writtings where estimid = @estid", cnx)) {
cmdw.Parameters.AddWithValue ("@estid", estimid);
using (NpgsqlDataReader rdrw = cmdw.ExecuteReader ()) {
List<Writting> lw = null;
if (rdrw.HasRows) {
lw = new List<Writting> ();
while (rdrw.Read ()) {
Writting w = new Writting ();
int dei = rdrw.GetOrdinal ("description");
if (!rdrw.IsDBNull (dei))
w.Description = rdrw.GetString (dei);
int opi = rdrw.GetOrdinal ("productid");
if (!rdrw.IsDBNull (opi))
w.ProductReference = rdrw.GetString (opi);
int oco = rdrw.GetOrdinal ("count");
if (!rdrw.IsDBNull (oco))
w.Count = rdrw.GetInt32 (oco);
int ouc = rdrw.GetOrdinal ("ucost");
if (!rdrw.IsDBNull (ouc))
w.UnitaryCost = rdrw.GetDecimal (ouc);
w.Id = rdrw.GetInt64 (rdrw.GetOrdinal ("_id"));
lw.Add (w);
}
est.Lines = lw.ToArray ();
}
}
}
return est;
}
}
/// <summary>
/// Updates the writting.
/// </summary>
/// <param name="wr">Wr.</param>
public void UpdateWritting (Writting wr)
{
using (NpgsqlConnection cnx = CreateConnection ()) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText =
"update writtings set " +
"description = @desc, " +
"ucost = @ucost, " +
"count = @count, " +
"productid = @prdid " +
"where _id = @wrid";
cmd.Parameters.AddWithValue ("@wrid", wr.Id);
cmd.Parameters.AddWithValue ("@desc", wr.Description);
cmd.Parameters.AddWithValue ("@ucost", wr.UnitaryCost);
cmd.Parameters.AddWithValue ("@prdid", wr.ProductReference);
cmd.Parameters.AddWithValue ("@count", wr.Count);
cnx.Open ();
cmd.ExecuteNonQuery ();
cnx.Close ();
}
}
}
/// <summary>
/// Saves the given Estimate object in database.
/// </summary>
/// <param name="estim">the Estimate object.</param>
public void Update (Estimate estim)
{
using (NpgsqlConnection cnx = CreateConnection ()) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText =
"update estimate set title = @tit, username = @un, " +
"description = @descr, client = @cli where _id = @estid";
cmd.Parameters.AddWithValue ("@tit", estim.Title);
cmd.Parameters.AddWithValue ("@un", estim.Responsible);
cmd.Parameters.AddWithValue ("@descr", estim.Description);
cmd.Parameters.AddWithValue ("@cli", estim.Client);
cmd.Parameters.AddWithValue ("@estid", estim.Id);
cnx.Open ();
cmd.ExecuteNonQuery ();
cnx.Close ();
}
}
}
/// <summary>
/// Add a line to the specified estimate by id,
/// using the specified desc, ucost, count and productid.
/// </summary>
/// <param name="estid">Estimate identifier.</param>
/// <param name="desc">Textual description for this line.</param>
/// <param name="ucost">Unitary cost.</param>
/// <param name="count">Cost multiplier.</param>
/// <param name="productid">Product identifier.</param>
public long Write (long estid, string desc, decimal ucost, int count, string productid)
{
using (NpgsqlConnection cnx = CreateConnection ()) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText =
"insert into writtings (description, estimid, ucost, count, productid) VALUES (@dscr,@estid,@ucost,@count,@prdid) returning _id";
cmd.Parameters.AddWithValue ("@dscr", desc);
cmd.Parameters.AddWithValue ("@estid", estid);
cmd.Parameters.AddWithValue ("@ucost", ucost);
cmd.Parameters.AddWithValue ("@count", count);
cmd.Parameters.AddWithValue ("@prdid", productid);
cnx.Open ();
long res = (long)cmd.ExecuteScalar ();
cnx.Close ();
return res;
}
}
}
/// <summary>
/// Sets the desc.
/// </summary>
/// <param name="writid">Writid.</param>
/// <param name="newDesc">New desc.</param>
public void SetDesc (long writid, string newDesc)
{
using (NpgsqlConnection cnx = CreateConnection ()) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText =
"update writtings set description = @dscr where _id = @writid";
cmd.Parameters.AddWithValue ("@tit", newDesc);
cmd.Parameters.AddWithValue ("@writid", writid);
cnx.Open ();
cmd.ExecuteNonQuery ();
cnx.Close ();
}
}
}
/// <summary>
/// Creates the estimate.
/// </summary>
/// <returns>The estimate.</returns>
/// <param name="client">Client.</param>
/// <param name="title">Title.</param>
/// <param name="responsible">Responsible.</param>
/// <param name="description">Description.</param>
public Estimate CreateEstimate (string responsible, string client, string title, string description)
{
using (NpgsqlConnection cnx = CreateConnection ()) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText =
"insert into estimate (title,description,username,client,applicationname) " +
"values (@tit,@descr,@resp,@un,@app) returning _id";
cmd.Parameters.AddWithValue ("@tit", title);
cmd.Parameters.AddWithValue ("@un", client);
cmd.Parameters.AddWithValue ("@resp", responsible);
cmd.Parameters.AddWithValue ("@descr", description);
cmd.Parameters.AddWithValue ("@app", ApplicationName);
cnx.Open ();
Estimate created = new Estimate ();
created.Id = (long)cmd.ExecuteScalar ();
cnx.Close ();
created.Title = title;
created.Description = description;
created.Client = client;
created.Responsible = responsible;
return created;
}
}
}
string applicationName = null;
/// <summary>
/// Gets or sets the name of the application.
/// </summary>
/// <value>The name of the application.</value>
public string ApplicationName {
get {
return applicationName;
}
set {
applicationName = value;
}
}
string cnxstr = null;
/// <summary>
/// Initialize this object using the specified name and config.
/// </summary>
/// <param name="name">Name.</param>
/// <param name="config">Config.</param>
public override void Initialize (string name, NameValueCollection config)
{
if (string.IsNullOrWhiteSpace (config ["connectionStringName"]))
throw new ConfigurationErrorsException ("No name for Npgsql connection string found");
cnxstr = ConfigurationManager.ConnectionStrings [config ["connectionStringName"]].ConnectionString;
applicationName = config ["applicationName"] ?? "/";
}
/// <summary>
/// Creates the connection.
/// </summary>
/// <returns>The connection.</returns>
protected NpgsqlConnection CreateConnection ()
{
return new NpgsqlConnection (cnxstr);
}
}
}

@ -1,94 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{821FF72D-9F4B-4A2C-B95C-7B965291F119}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>WorkFlowProvider</RootNamespace>
<AssemblyName>NpgsqlContentProvider</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<DocumentationFile>bin\Debug\WorkFlowProvider.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Lua|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Lua</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'TotemPre|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\TotemPre</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'TotemProd|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\TotemProd</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'YavscPre|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\YavscPre</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Yavsc|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Yavsc</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'LuaDebug|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Lua</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Web" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml" />
<Reference Include="Npgsql">
<HintPath>..\packages\Npgsql.3.0.5\lib\net45\Npgsql.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.8.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="NpgsqlContentProvider.cs" />
<Compile Include="NpgsqlCircleProvider.cs" />
<Compile Include="NpgsqlSkillProvider.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\yavscModel\YavscModel.csproj">
<Project>{68F5B80A-616E-4C3C-91A0-828AA40000BD}</Project>
<Name>YavscModel</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>

@ -1,450 +0,0 @@
//
// NpgsqlSkillProvider.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using Yavsc.Model.Skill;
using System.Configuration;
using System.Collections.Specialized;
using System.Collections.Generic;
using Npgsql;
using NpgsqlTypes;
using Yavsc.Model.FrontOffice;
namespace WorkFlowProvider
{
/// <summary>
/// Npgsql skill provider.
/// </summary>
public class NpgsqlSkillProvider : SkillProvider
{
/// <summary>
/// Initializes a new instance of the <see cref="WorkFlowProvider.NpgsqlSkillProvider"/> class.
/// </summary>
public NpgsqlSkillProvider ()
{
}
string connectionString = null;
string applicationName = null;
/// <summary>
/// Initialize this object using the specified name and config.
/// </summary>
/// <param name="name">Name.</param>
/// <param name="config">Config.</param>
public override void Initialize (string name, NameValueCollection config)
{
if (string.IsNullOrWhiteSpace (config ["connectionStringName"]))
throw new ConfigurationErrorsException ("No name for Npgsql connection string found");
connectionString = ConfigurationManager.ConnectionStrings [config ["connectionStringName"]].ConnectionString;
applicationName = config ["applicationName"] ?? "/";
}
#region implemented abstract members of SkillProvider
/// <summary>
/// Gets the user skills.
/// </summary>
/// <returns>The user skills.</returns>
/// <param name="username">Username.</param>
public override PerformerProfile GetUserSkills (string username)
{
var skills = new List <UserSkill> ();
var profile = new PerformerProfile (username);
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText =
"select p.uniqueid, d.rate, d.MEACode, u.email " +
" from users u, profiles p, profiledata d where " +
" u.username = :user and u.applicationname = :app " +
" and p.username = u.username " +
" and p.applicationname = u.applicationname " +
" and p.uniqueid = d.uniqueid ";
cmd.Parameters.AddWithValue ("user", NpgsqlTypes.NpgsqlDbType.Varchar, username);
cmd.Parameters.AddWithValue ("app", NpgsqlTypes.NpgsqlDbType.Varchar, applicationName);
using (var rdr = cmd.ExecuteReader ()) {
rdr.Read ();
profile.Id = rdr.GetInt64 (0);
profile.Rate = rdr.GetInt32 (1);
profile.MEACode = rdr.GetString (2);
profile.EMail = rdr.GetString (3);
}
}
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText =
" select u._id, u.skillid, s.name, " +
" u.comment, u.rate from userskills u, " +
" skill s " +
" where u.skillid = s._id and " +
" u.username = :uname " +
" and s.applicationname = u.applicationname " +
" and s.applicationname = :app " +
" and s.meacode = :mea " +
" order by u.rate desc ";
cmd.Parameters.AddWithValue ("uname", NpgsqlTypes.NpgsqlDbType.Varchar, username);
cmd.Parameters.AddWithValue ("app", NpgsqlTypes.NpgsqlDbType.Varchar, applicationName);
cmd.Parameters.AddWithValue ("mea", NpgsqlTypes.NpgsqlDbType.Varchar, profile.MEACode);
cmd.Prepare ();
using (var rdr = cmd.ExecuteReader ()) {
if (rdr.HasRows)
while (rdr.Read ()) {
skills.Add (new UserSkill () {
Id = rdr.GetInt64 (0),
SkillId = rdr.GetInt64 (1),
SkillName = rdr.GetString (2),
Comment = rdr.GetString (3),
Rate = rdr.GetInt32 (4)
});
}
profile.Skills = skills.ToArray ();
}
}
cnx.Close ();
}
return profile;
}
/// <summary>
/// Create the specified skill.
/// </summary>
/// <param name="skill">skill.</param>
public override long Declare (SkillEntity skill)
{
long res = 0;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
if (skill.Id == 0) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "insert into skill (name,meacode,rate,applicationname) " +
" values (:name,:mea,:rate,:app) " +
" returning _id ";
cmd.Parameters.AddWithValue ("name", NpgsqlTypes.NpgsqlDbType.Varchar, skill.Name);
cmd.Parameters.AddWithValue ("mea", NpgsqlTypes.NpgsqlDbType.Varchar, skill.MEACode);
cmd.Parameters.AddWithValue ("rate",
NpgsqlTypes.NpgsqlDbType.Integer, skill.Rate);
cmd.Parameters.AddWithValue ("app", NpgsqlTypes.NpgsqlDbType.Varchar, applicationName);
res = (long)cmd.ExecuteScalar ();
}
} else {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "update skill set name = :name, rate = :rate where _id = :sid";
cmd.Parameters.AddWithValue ("name", NpgsqlTypes.NpgsqlDbType.Bigint, skill.Id);
cmd.Parameters.AddWithValue ("rate",
NpgsqlTypes.NpgsqlDbType.Integer, skill.Rate);
cmd.ExecuteNonQuery ();
}
}
cnx.Close ();
}
return res;
}
/// <summary>
/// Declares the userskill.
/// </summary>
/// <returns>The userskill.</returns>
/// <param name="userskill">userskill.</param>
public override long Declare (UserSkillDeclaration userskill)
{
long res = 0;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
if (userskill.Id == 0) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
if (userskill.Comment == null)
userskill.Comment = "";
cmd.CommandText = "insert into userskills" +
" (username, applicationname, skillid, rate, comment) " +
" values (:uname,:app,:sid,:rate,:cmnt) returning _id";
cmd.Parameters.AddWithValue ("uname",
NpgsqlTypes.NpgsqlDbType.Varchar, userskill.UserName);
cmd.Parameters.AddWithValue ("app",
NpgsqlTypes.NpgsqlDbType.Varchar, applicationName);
cmd.Parameters.AddWithValue ("sid",
NpgsqlTypes.NpgsqlDbType.Bigint, userskill.SkillId);
cmd.Parameters.AddWithValue ("rate",
NpgsqlTypes.NpgsqlDbType.Integer, userskill.Rate);
cmd.Parameters.AddWithValue ("cmnt",
NpgsqlTypes.NpgsqlDbType.Varchar, userskill.Comment);
userskill.Id = res = (long)cmd.ExecuteScalar ();
}
} else {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "update userskills" +
" set rate = :rate," +
" comment = :cmnt) " +
" where _id = :usid ";
cmd.Parameters.AddWithValue ("cmnt",
NpgsqlTypes.NpgsqlDbType.Varchar, userskill.Comment);
cmd.Parameters.AddWithValue ("rate",
NpgsqlTypes.NpgsqlDbType.Integer, userskill.Rate);
cmd.Parameters.AddWithValue ("usid",
NpgsqlTypes.NpgsqlDbType.Bigint, userskill.Id);
cmd.ExecuteNonQuery ();
}
}
cnx.Close ();
}
return res;
}
/// <summary>
/// Rate the specified user's skill.
/// It creates the record describing the user's skill
/// if not existent.
/// </summary>
/// <param name="userSkill">UserSkillRating.</param>
public override long Rate (UserSkillRating userSkill)
{
// TODO Use the Author value to choose
// between a self rating that goes into the `userskills` table
// and a client rating that goes into the
// `statisfaction` table.
long usid = 0;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
if (userSkill.Id == 0) {
cmd.CommandText = "insert into userskills " +
" ( skillid, rate, username, applicationname ) " +
" values ( :sid, :rate, :uname, :app ) " +
" returning _id ";
cmd.Parameters.AddWithValue ("sid", NpgsqlDbType.Bigint, userSkill.Id);
cmd.Parameters.AddWithValue ("rate", NpgsqlDbType.Integer, userSkill.Rate);
cmd.Parameters.AddWithValue ("uname", NpgsqlDbType.Varchar, userSkill.Performer);
cmd.Parameters.AddWithValue ("app", NpgsqlDbType.Varchar, applicationName);
usid = (long)cmd.ExecuteScalar ();
} else {
cmd.CommandText = "update userskills " +
" set rate = :rate " +
" where _id = :usid ";
cmd.Parameters.AddWithValue ("rate", NpgsqlDbType.Integer, userSkill.Rate);
cmd.Parameters.AddWithValue ("usid", NpgsqlDbType.Bigint, userSkill.Id);
cmd.ExecuteNonQuery ();
}
}
cnx.Close ();
}
return usid;
}
/// <summary>
/// Rate the specified skill.
/// The access to this method
/// should be restricted to an Admin,
/// or a rating engine
/// </summary>
/// <param name="skill">Skill.</param>
public override void Rate (AuthentificatedSkillRating skill)
{
// TODO Use the Author value to choose
// between a global setting for the application
// and an user setting on his needs
// when the `Author` value is not null,
// it's concerning a rating on a need of the Author
// if not, it's a need of the site
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "update skill set rate = :rate where _id = :sid";
cmd.Parameters.AddWithValue ("sid", NpgsqlTypes.NpgsqlDbType.Bigint, skill.Id);
cmd.Parameters.AddWithValue ("rate", NpgsqlTypes.NpgsqlDbType.Integer, skill.Rate);
cmd.ExecuteNonQuery ();
}
cnx.Close ();
}
}
/// <summary>
/// Finds the skills.
/// </summary>
/// <returns>The skill identifier.</returns>
/// <param name="pattern">Pattern.</param>
/// <param name="MEACode">MEA Code.</param>
public override SkillEntity[] FindSkill (string pattern, string MEACode)
{
List<SkillEntity> skills = new List<SkillEntity> ();
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select _id, name, rate, meacode " +
" from skill " +
" where name like :name ";
if (MEACode != null)
cmd.CommandText +=
" and meacode = :mea ";
cmd.CommandText += " and applicationname = :app " +
" order by rate desc";
cmd.Parameters.AddWithValue ("name", NpgsqlTypes.NpgsqlDbType.Varchar, pattern);
if (MEACode != null)
cmd.Parameters.AddWithValue ("mea", NpgsqlTypes.NpgsqlDbType.Varchar, MEACode);
cmd.Parameters.AddWithValue ("app", NpgsqlTypes.NpgsqlDbType.Varchar, applicationName);
cmd.Prepare ();
using (var rdr = cmd.ExecuteReader ()) {
if (rdr.HasRows)
while (rdr.Read ()) {
skills.Add (new SkillEntity () {
Id = (long)rdr.GetInt64 (0),
Name = (string)rdr.GetString (1),
Rate = (int)rdr.GetInt32 (2),
MEACode = (string)rdr.GetString (3),
});
}
}
}
cnx.Close ();
}
return skills.ToArray ();
}
/// <summary>
/// Finds the performer.
/// </summary>
/// <returns>The performer.</returns>
/// <param name="MEACode">MEACode.</param>
/// <param name="skills">Skills.</param>
public override string[] FindPerformer (string MEACode, SkillRating [] skills)
{
var res = new List<string> ();
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
if (skills != null) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
// on cherche ici simplement les prestataires
// ayant déclaré les compétences spécifiées.
cmd.CommandText = @" select u.username
from userskills s, profiledata p, profiles q, users u
where s.username = u.username
and s.applicationname = u.applicationname
and s.skillid = :sid
and p.meacode = :mea
and u.username = q.username
and u.applicationname = q.applicationname
and p.uniqueid = q.uniqueid
and u.applicationname = :app
and u.islockedout = FALSE
and u.isapproved = TRUE
order by s.rate desc ";
cmd.Parameters.AddWithValue ("sid", NpgsqlDbType.Bigint, 0);
cmd.Parameters.AddWithValue ("app", NpgsqlDbType.Varchar, applicationName);
cmd.Parameters.AddWithValue ("mea", NpgsqlDbType.Varchar, MEACode);
cmd.Prepare ();
foreach (SkillRating skill in skills) {
cmd.Parameters ["sid"].Value = skill.Id;
using (var rdr = cmd.ExecuteReader ()) {
while (rdr.Read ()) {
string uname = rdr.GetString (0);
if (!res.Contains (uname))
res.Add (uname);
}
}
}
}
}
if (res.Count < 10) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
// Si on a trouvé trop peu de prestataire ayant
// déclaré ces compétences (moins de 10),
// On en cherche un ayant
// simplement déclaré avoir l'activité
// concernée.
// TODO implement a configuration parameter :
cmd.CommandText = " select u.username " +
" from profiledata p, profiles q, users u " +
" where u.username = q.username " +
" and u.applicationname = q.applicationname " +
" and p.uniqueid = q.uniqueid " +
" and p.meacode = :mea " +
" and u.applicationname = :app " +
" and u.islockedout = FALSE " +
" and u.isapproved = TRUE " +
" order by p.rate desc " ;
cmd.Parameters.AddWithValue ("app", NpgsqlDbType.Varchar, applicationName);
cmd.Parameters.AddWithValue ("mea", NpgsqlDbType.Varchar, MEACode);
using (var rdr = cmd.ExecuteReader ()) {
while (rdr.Read ()) {
string uname = rdr.GetString (0);
if (!res.Contains (uname))
res.Add (uname);
}
}
}
}
cnx.Close ();
}
return res.ToArray ();
}
/// <summary>
/// Deletes the skill.
/// </summary>
/// <param name="skillId">Skill identifier.</param>
public override void DeleteSkill (long skillId)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = " delete from skill " +
" where _id = :sid ";
cmd.Parameters.AddWithValue ("sid", NpgsqlTypes.NpgsqlDbType.Bigint, skillId);
cmd.ExecuteNonQuery ();
}
cnx.Close ();
}
}
/// <summary>
/// Deletes the user skill.
/// </summary>
/// <param name="userSkillId">User skill identifier.</param>
public override void DeleteUserSkill (long userSkillId)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = " delete from userskills " +
" where _id = :usid ";
cmd.Parameters.AddWithValue ("usid", NpgsqlTypes.NpgsqlDbType.Bigint, userSkillId);
cmd.ExecuteNonQuery ();
}
cnx.Close ();
}
}
#endregion
}
}

@ -1,22 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("WorkFlowProvider")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("Paul Schneider")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net451" />
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net451" />
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net451" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net451" />
<package id="Newtonsoft.Json" version="8.0.1" targetFramework="net451" />
<package id="Npgsql" version="3.0.5" targetFramework="net451" />
</packages>

@ -1,27 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("NpgsqlMRPProviders")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("paul")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

@ -1,110 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{BBA7175D-7F92-4278-96FC-84C495A2B5A6}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Npgsql.Web</RootNamespace>
<AssemblyName>NpgsqlMRPProviders</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<DocumentationFile>bin\Debug\NpgsqlMRPProviders.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Lua|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Lua</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'TotemPre|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\TotemPre</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'TotemProd|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\TotemProd</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'YavscPre|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\YavscPre</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Yavsc|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Yavsc</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'LuaDebug|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Lua</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Compile Include="NpgsqlMembershipProvider.cs" />
<Compile Include="NpgsqlRoleProvider.cs" />
<Compile Include="NpgsqlProfileProvider.cs" />
<Compile Include="AssemblyInfo.cs" />
<Compile Include="NpgsqlUserNameProvider.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Web" />
<Reference Include="System.Configuration" />
<Reference Include="System" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Data" />
<Reference Include="System.Data.Linq" />
<Reference Include="System.Core" />
<Reference Include="Npgsql">
<HintPath>..\packages\Npgsql.3.0.5\lib\net45\Npgsql.dll</HintPath>
</Reference>
</ItemGroup>
<ProjectExtensions>
<MonoDevelop>
<Properties>
<Policies>
<DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedFlat" ResourceNamePolicy="FileFormatDefault" />
</Policies>
</Properties>
</MonoDevelop>
</ProjectExtensions>
<ItemGroup>
<Folder Include="Sql\" />
</ItemGroup>
<ItemGroup>
<None Include="Sql\UsersTable.sql" />
<None Include="Sql\ProfileData.sql" />
<None Include="Sql\RolesTable.sql" />
<None Include="Sql\UserRoleTable.sql" />
<None Include="Sql\StockSymbols.sql" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\yavscModel\YavscModel.csproj">
<Project>{68F5B80A-616E-4C3C-91A0-828AA40000BD}</Project>
<Name>YavscModel</Name>
</ProjectReference>
</ItemGroup>
</Project>

File diff suppressed because it is too large Load Diff

@ -1,348 +0,0 @@
using System;
using System.Configuration;
using System.Web.Profile;
using Npgsql;
namespace Npgsql.Web
{
/// <summary>
/// Npgsql profile provider.
/// </summary>
public class NpgsqlProfileProvider: ProfileProvider
{
private string connectionString;
private string applicationName;
/// <summary>
/// Initializes a new instance of the <see cref="Npgsql.Web.NpgsqlProfileProvider"/> class.
/// </summary>
public NpgsqlProfileProvider ()
{
}
/// <summary>
/// Initialize the specified iname and config.
/// </summary>
/// <param name="iname">Iname.</param>
/// <param name="config">Config.</param>
public override void Initialize (string iname, System.Collections.Specialized.NameValueCollection config)
{
// get the
// - application name
// - connection string name
// - the connection string from its name
string cnxName = config ["connectionStringName"];
connectionString = ConfigurationManager.ConnectionStrings [cnxName].ConnectionString;
config.Remove ("connectionStringName");
applicationName = config ["applicationName"];
config.Remove ("applicationName");
base.Initialize (iname, config);
}
#region implemented abstract members of System.Web.Profile.ProfileProvider
/// <summary>
/// Deletes the inactive profiles.
/// </summary>
/// <returns>The inactive profiles.</returns>
/// <param name="authenticationOption">Authentication option.</param>
/// <param name="userInactiveSinceDate">User inactive since date.</param>
public override int DeleteInactiveProfiles (ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
{
throw new System.NotImplementedException ();
}
/// <summary>
/// Deletes the profiles.
/// </summary>
/// <returns>The profiles.</returns>
/// <param name="usernames">Usernames.</param>
public override int DeleteProfiles (string[] usernames)
{
throw new System.NotImplementedException ();
}
/// <summary>
/// Deletes the profiles.
/// </summary>
/// <returns>The profiles.</returns>
/// <param name="profiles">Profiles.</param>
public override int DeleteProfiles (ProfileInfoCollection profiles)
{
throw new System.NotImplementedException ();
}
/// <Docs>To be added.</Docs>
/// <param name="userInactiveSinceDate">To be added.</param>
/// <param name="pageSize">To be added.</param>
/// <summary>
/// To be added.
/// </summary>
/// <remarks>To be added.</remarks>
/// <returns>The inactive profiles by user name.</returns>
/// <param name="authenticationOption">Authentication option.</param>
/// <param name="usernameToMatch">Username to match.</param>
/// <param name="pageIndex">Page index.</param>
/// <param name="totalRecords">Total records.</param>
public override ProfileInfoCollection FindInactiveProfilesByUserName (ProfileAuthenticationOption authenticationOption, string usernameToMatch, DateTime userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
{
throw new System.NotImplementedException ();
}
/// <Docs>To be added.</Docs>
/// <param name="pageIndex">To be added.</param>
/// <param name="totalRecords">To be added.</param>
/// <returns>To be added.</returns>
/// <since version=".NET 2.0"></since>
/// <summary>
/// Finds the name of the profiles by user.
/// </summary>
/// <param name="authenticationOption">Authentication option.</param>
/// <param name="usernameToMatch">Username to match.</param>
/// <param name="pageSize">Page size.</param>
public override ProfileInfoCollection FindProfilesByUserName (ProfileAuthenticationOption authenticationOption, string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
{
if (pageIndex < 0)
throw new ArgumentException ("pageIndex");
if (pageSize < 1)
throw new ArgumentException ("pageSize");
long lowerBound = (long)pageIndex * pageSize;
long upperBound = lowerBound + pageSize - 1;
if (upperBound > Int32.MaxValue)
throw new ArgumentException ("lowerBound + pageSize*pageIndex -1 > Int32.MaxValue");
ProfileInfoCollection c = new ProfileInfoCollection ();
totalRecords = 0;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select username, uniqueid, lastactivitydate, lastupdateddate, isanonymous from profiles where username like @username and applicationname = @appname";
cmd.Parameters.AddWithValue ("@username", usernameToMatch);
cmd.Parameters.AddWithValue ("@appname", applicationName);
cnx.Open ();
using (NpgsqlDataReader r = cmd.ExecuteReader ()) {
if (r.HasRows) {
while (r.Read ()) {
if (totalRecords >= lowerBound && totalRecords <= upperBound) {
object o = r.GetValue (r.GetOrdinal ("isanonymous"));
bool isanon = o is DBNull ? true : (bool) o;
o = r.GetValue (r.GetOrdinal ("lastactivitydate"));
DateTime lact = o is DBNull ? new DateTime() : (DateTime) o;
o = r.GetValue (r.GetOrdinal ("lastupdateddate"));
DateTime lupd = o is DBNull ? new DateTime() : (DateTime) o;
ProfileInfo pi =
new ProfileInfo (
r.GetString (r.GetOrdinal ("username")),
isanon,
lact,
lupd,
0);
c.Add (pi);
totalRecords++;
}
}
}
}
}
}
return c;
}
/// <Docs>To be added.</Docs>
/// <param name="pageIndex">To be added.</param>
/// <param name="totalRecords">To be added.</param>
/// <returns>To be added.</returns>
/// <since version=".NET 2.0"></since>
/// <summary>
/// Gets all inactive profiles.
/// </summary>
/// <param name="authenticationOption">Authentication option.</param>
/// <param name="userInactiveSinceDate">User inactive since date.</param>
/// <param name="pageSize">Page size.</param>
public override ProfileInfoCollection GetAllInactiveProfiles (ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
{
throw new System.NotImplementedException ();
}
/// <Docs>To be added.</Docs>
/// <param name="pageSize">To be added.</param>
/// <summary>
/// To be added.
/// </summary>
/// <remarks>To be added.</remarks>
/// <returns>The all profiles.</returns>
/// <param name="authenticationOption">Authentication option.</param>
/// <param name="pageIndex">Page index.</param>
/// <param name="totalRecords">Total records.</param>
public override ProfileInfoCollection GetAllProfiles (ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords)
{
throw new System.NotImplementedException ();
}
/// <summary>
/// Gets the number of inactive profiles.
/// </summary>
/// <returns>The number of inactive profiles.</returns>
/// <param name="authenticationOption">Authentication option.</param>
/// <param name="userInactiveSinceDate">User inactive since date.</param>
public override int GetNumberOfInactiveProfiles (ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
{
throw new System.NotImplementedException ();
}
#endregion
#region implemented abstract members of System.Configuration.SettingsProvider
/// <summary>
/// Gets the property values.
/// </summary>
/// <returns>The property values.</returns>
/// <param name="context">Context.</param>
/// <param name="collection">Collection.</param>
public override SettingsPropertyValueCollection GetPropertyValues (SettingsContext context, SettingsPropertyCollection collection)
{// TODO get anon
SettingsPropertyValueCollection c = new SettingsPropertyValueCollection ();
if (collection == null || collection.Count < 1 || context == null)
return c;
string username = (string) context ["UserName"];
if (String.IsNullOrEmpty (username))
return c;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "SELECT * from profiledata, profiles where " +
"profiledata.uniqueid = profiles.uniqueid " +
"and profiles.username = @username " +
"and profiles.applicationname = @appname ";
cmd.Parameters.AddWithValue ("@username", username);
cmd.Parameters.AddWithValue ("@appname", applicationName);
cnx.Open ();
using (NpgsqlDataReader r = cmd.ExecuteReader (
System.Data.CommandBehavior.CloseConnection | System.Data.CommandBehavior.SingleRow)) {
if (r.Read ()) {
foreach (SettingsProperty p in collection) {
SettingsPropertyValue v = new SettingsPropertyValue (p);
int o = r.GetOrdinal (p.Name.ToLower ());
var obj = r.GetValue (o);
v.PropertyValue = (obj is DBNull) ? GetDefaultValue (p) : obj;
c.Add (v);
}
} else {
foreach (SettingsProperty p in collection) {
SettingsPropertyValue v = new SettingsPropertyValue (p);
v.PropertyValue = GetDefaultValue(p);
c.Add (v);
}
}
}
}
return c;
}
private object GetDefaultValue(SettingsProperty setting)
{
if (setting.PropertyType.IsEnum)
return Enum.Parse(setting.PropertyType, setting.DefaultValue.ToString());
// Return the default value if it is set
if (setting.DefaultValue != null)
{
System.ComponentModel.TypeConverter tc = System.ComponentModel.TypeDescriptor.GetConverter(setting.PropertyType);
return tc.ConvertFromString(setting.DefaultValue.ToString());
}
else // If there is no default value return the default object
{
return Activator.CreateInstance(setting.PropertyType);
}
}
/// <summary>
/// Sets the property values.
/// </summary>
/// <param name="context">Context.</param>
/// <param name="collection">Collection.</param>
public override void SetPropertyValues (SettingsContext context, SettingsPropertyValueCollection collection)
{
// get the unique id of the profile
if (collection == null)
return;
long puid = 0;
string username = (string) context ["UserName"];
bool needsAProfileDataRecord = false;
// This user is either a authentified username, or an anonymous asp user id
// He's anonymous when he's got no associated record in the "users" table
// But, as long as our membership provider creates a mandatory (by db constraint) associated
// record in the profile table, with a "isanonymous" field value to FALSE,
// we can asume that an inexistant profile, once here, is an anonymous profile
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
using (NpgsqlCommand cmdpi = cnx.CreateCommand ()) {
cmdpi.CommandText = "select count(uniqueid) " +
"from profiles where username = :username " +
"and applicationname = :appname";
cmdpi.Parameters.AddWithValue ("username", username);
cmdpi.Parameters.AddWithValue ("appname", applicationName);
long c = (long)cmdpi.ExecuteScalar ();
if (c == 0) {
// This is a new anonymous profile.
// the `isanonymous` field should be specified true by default in the ddl
cmdpi.CommandText = "insert into profiles (username,applicationname) " +
"values ( :username, :appname ) " +
"returning uniqueid";
puid = (long) cmdpi.ExecuteScalar ();
needsAProfileDataRecord = true;
} else {
// here we're roughly sure to get the id
cmdpi.CommandText = "select uniqueid from profiles where username = :username " +
"and applicationname = :appname";
puid = (long) cmdpi.ExecuteScalar ();
// but still no data
using (NpgsqlCommand cmdgetdataprid = cnx.CreateCommand ()) {
cmdgetdataprid.CommandText = "select count(uniqueid) from profiledata where uniqueid = :puid";
cmdgetdataprid.Parameters.AddWithValue ("puid", puid);
long cd = (long) cmdgetdataprid.ExecuteScalar ();
if (cd == 0) {
needsAProfileDataRecord = true;
}
}
}
}
if (needsAProfileDataRecord) using (NpgsqlCommand cmdpdins = cnx.CreateCommand ()) {
cmdpdins.CommandText = "insert into profiledata (uniqueid) values (:puid)";
cmdpdins.Parameters.AddWithValue ("puid", puid);
cmdpdins.ExecuteNonQuery ();
}
foreach (SettingsPropertyValue s in collection) {
if (s.UsingDefaultValue) {
//TODO ? Drop the property in the profile
} else {
// update the property value
// TODO update to null values (included to avoid Not Implemented columns in profiledata
if (s.PropertyValue != null) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = string.Format (
"update profiledata " +
"set {0} = @val " +
"where uniqueid = @puid ",
s.Name
);
cmd.Parameters.AddWithValue ("@puid", puid);
cmd.Parameters.AddWithValue ("@val", s.PropertyValue);
cmd.ExecuteNonQuery ();
}
}
}
}
}
}
/// <summary>
/// Gets or sets the name of the application.
/// </summary>
/// <value>The name of the application.</value>
public override string ApplicationName {
get {
return applicationName;
}
set {
applicationName = value;
}
}
#endregion
}
}

@ -1,410 +0,0 @@
using System;
using System.Web.Security;
using System.Configuration.Provider;
using System.Configuration;
using Npgsql;
using System.Collections.Generic;
using System.Linq;
using System.Collections.Specialized;
namespace Npgsql.Web
{
/// <summary>
/// Npgsql role provider.
/// </summary>
public class NpgsqlRoleProvider: RoleProvider
{
/// <summary>
/// The name.
/// </summary>
protected string name = "NpgsqlRoleProvider";
/// <summary>
/// The name of the connection string.
/// </summary>
protected string connectionStringName = "pgProvider";
/// <summary>
/// The name of the application.
/// </summary>
protected string applicationName = "/";
/// <summary>
/// The connection string.
/// </summary>
protected string connectionString = string.Empty;
/// <summary>
/// Initialize the specified iname and config.
/// </summary>
/// <param name="iname">Iname.</param>
/// <param name="config">Config.</param>
public override void Initialize (string iname, NameValueCollection config)
{
// get the
// - application name
// - connection string name
// - the connection string from its name
string cnxName = config ["connectionStringName"];
connectionString = ConfigurationManager.ConnectionStrings [cnxName].ConnectionString;
config.Remove ("connectionStringName");
applicationName = config ["applicationName"];
config.Remove ("applicationName");
base.Initialize (iname, config);
}
/// <Docs>To be added.</Docs>
/// <summary>
/// Adds the users to roles.
/// </summary>
/// <param name="usernames">Usernames.</param>
/// <param name="roleNames">Role names.</param>
public override void AddUsersToRoles (string[] usernames, string[] roleNames)
{
if (usernames.Any (x => x == null) || roleNames.Any (x => x == null)) {
throw new ArgumentNullException ();
}
if (usernames.Any (x => x.Trim () == string.Empty) || (roleNames.Any (x => x.Trim () == string.Empty))) {
throw new ArgumentException ("One or more of the supplied usernames or role names are empty.");
}
using (var conn = new NpgsqlConnection(connectionString)) {
conn.Open ();
using (var comm = conn.CreateCommand()) {
comm.CommandType = System.Data.CommandType.Text;
comm.CommandText = "insert into usersroles (applicationname, username, rolename) values (@appname,@user,@role)";
comm.Parameters.AddWithValue ("appname", NpgsqlTypes.NpgsqlDbType.Varchar, 250).Value = applicationName;
NpgsqlParameter pu = comm.Parameters.AddWithValue ("user", NpgsqlTypes.NpgsqlDbType.Varchar, 250);
NpgsqlParameter pr = comm.Parameters.AddWithValue ("role", NpgsqlTypes.NpgsqlDbType.Varchar, 250);
foreach (string u in usernames) {
pu.Value = u;
foreach (string r in roleNames) {
pr.Value = r;
comm.ExecuteNonQuery ();
}
}
}
}
}
/// <summary>
/// Gets or sets the name of the application.
/// </summary>
/// <value>The name of the application.</value>
public override string ApplicationName {
get {
return applicationName;
}
set {
applicationName = value;
}
}
/// <Docs>To be added.</Docs>
/// <summary>
/// Creates the role.
/// </summary>
/// <param name="roleName">Role name.</param>
public override void CreateRole (string roleName)
{
if (roleName == null)
throw new ArgumentNullException ();
if (roleName.Trim () == string.Empty)
throw new ArgumentException ("A role name cannot be empty.");
if (roleName.Contains (","))
throw new ArgumentException ("A role name cannot contain commas. Blame Microsoft for that rule!");
if (roleName.Length > 250)
throw new ArgumentException ("The maximum length for a Role name is 250 characters.");
using (var conn = new NpgsqlConnection(connectionString)) {
conn.Open ();
using (var comm = conn.CreateCommand()) {
comm.CommandType = System.Data.CommandType.Text;
comm.CommandText = "insert into roles (rolename, applicationname, comment) values (@rolename, @appname, @comment)";
comm.Parameters.AddWithValue ("@rolename", NpgsqlTypes.NpgsqlDbType.Varchar, 250).Value = roleName;
comm.Parameters.AddWithValue ("@appname", NpgsqlTypes.NpgsqlDbType.Varchar, 250).Value = applicationName;
comm.Parameters.AddWithValue ("@comment", NpgsqlTypes.NpgsqlDbType.Varchar, 250).Value = roleName;
comm.ExecuteNonQuery ();
}
}
}
/// <Docs>To be added.</Docs>
/// <summary>
/// Deletes the role.
/// </summary>
/// <returns><c>true</c>, if role was deleted, <c>false</c> otherwise.</returns>
/// <param name="roleName">Role name.</param>
/// <param name="throwOnPopulatedRole">If set to <c>true</c> throw on populated role.</param>
public override bool DeleteRole (string roleName, bool throwOnPopulatedRole)
{
if (roleName == null)
throw new ArgumentNullException ();
if (roleName.Trim () == string.Empty)
throw new ArgumentException ("The specified role name cannot be empty.");
if (throwOnPopulatedRole)
if (FindUsersInRole (roleName, "").Count () > 0)
throw new ProviderException (
string.Format ("The role {0} is populated, we cannot delete it.", roleName));
using (var conn = new NpgsqlConnection(connectionString)) {
conn.Open ();
using (var comm = conn.CreateCommand()) {
comm.CommandType = System.Data.CommandType.Text;
comm.CommandText = "delete from roles where rolename = @rolename and applicationname = @appname";
comm.Parameters.AddWithValue ("@rolename", NpgsqlTypes.NpgsqlDbType.Varchar, 250).Value = roleName;
comm.Parameters.AddWithValue ("@appname", NpgsqlTypes.NpgsqlDbType.Varchar, 250).Value = applicationName;
comm.Parameters.AddWithValue ("@comment", NpgsqlTypes.NpgsqlDbType.Varchar, 250).Value = roleName;
comm.ExecuteNonQuery ();
}
}
return true;
}
/// <summary>
/// Finds the users in role.
/// </summary>
/// <returns>The users in role.</returns>
/// <param name="roleName">Role name.</param>
/// <param name="usernameToMatch">Username to match.</param>
public override string[] FindUsersInRole (string roleName, string usernameToMatch)
{
return GetUsersInRole (roleName, usernameToMatch);
}
/// <summary>
/// Gets the users in role.
/// </summary>
/// <returns>The users in role.</returns>
/// <param name="rolename">Rolename.</param>
/// <param name="usernameToMatch">Username to match.</param>
protected string[] GetUsersInRole (string rolename, string usernameToMatch)
{
if (rolename == null)
throw new ArgumentNullException ();
if (rolename == string.Empty)
throw new ProviderException ("Cannot look for blank role names.");
usernameToMatch = usernameToMatch ?? string.Empty;
using (var conn = new NpgsqlConnection(connectionString)) {
conn.Open ();
using (var comm = conn.CreateCommand()) {
comm.CommandType = System.Data.CommandType.Text;
comm.CommandText = "select username from usersroles where applicationname = @appname " +
"and rolename = @rolename and username like @username";
comm.Parameters.AddWithValue ("@rolename", NpgsqlTypes.NpgsqlDbType.Varchar, 250).Value = rolename;
comm.Parameters.AddWithValue ("@appname", NpgsqlTypes.NpgsqlDbType.Varchar, 250).Value = applicationName;
comm.Parameters.AddWithValue ("@username", NpgsqlTypes.NpgsqlDbType.Varchar, 250).Value = usernameToMatch;
using (var reader = comm.ExecuteReader()) {
var r = new List<string> ();
var usernameColumn = reader.GetOrdinal ("username");
while (reader.Read()) {
r.Add (reader.GetString (usernameColumn));
}
return r.ToArray ();
}
}
}
}
/// <summary>
/// Gets all roles.
/// </summary>
/// <returns>The all roles.</returns>
public override string[] GetAllRoles ()
{
using (var conn = new NpgsqlConnection(connectionString)) {
conn.Open ();
using (var comm = conn.CreateCommand()) {
comm.CommandType = System.Data.CommandType.Text;
comm.CommandText = "select rolename from roles where applicationname = @appname";
comm.Parameters.AddWithValue ("@appname", NpgsqlTypes.NpgsqlDbType.Varchar, 250).Value = applicationName;
using (var reader = comm.ExecuteReader()) {
var r = new List<string> ();
var rolenameColumn = reader.GetOrdinal ("rolename");
while (reader.Read()) {
r.Add (reader.GetString (rolenameColumn));
}
return r.ToArray ();
}
}
}
}
/// <summary>
/// Gets the roles for user.
/// </summary>
/// <returns>The roles for user.</returns>
/// <param name="username">Username.</param>
public override string[] GetRolesForUser (string username)
{
if (username == null)
throw new ArgumentNullException ();
if (username.Trim () == string.Empty)
throw new ArgumentException ("The specified username cannot be blank.");
using (var conn = new NpgsqlConnection(connectionString)) {
conn.Open ();
using (var comm = conn.CreateCommand()) {
comm.CommandType = System.Data.CommandType.Text;
comm.CommandText = "select rolename from usersroles where applicationname = @appname and username = @username";
comm.Parameters.AddWithValue ("@username", NpgsqlTypes.NpgsqlDbType.Varchar, 250).Value = username;
comm.Parameters.AddWithValue ("@appname", NpgsqlTypes.NpgsqlDbType.Varchar, 250).Value = applicationName;
using (var reader = comm.ExecuteReader()) {
var r = new List<string> ();
var rolenameColumn = reader.GetOrdinal ("rolename");
while (reader.Read()) {
r.Add (reader.GetString (rolenameColumn));
}
return r.ToArray ();
}
}
}
}
/// <Docs>To be added.</Docs>
/// <summary>
/// Gets the users in role.
/// </summary>
/// <returns>The users in role.</returns>
/// <param name="roleName">Role name.</param>
public override string[] GetUsersInRole (string roleName)
{
if (string.IsNullOrEmpty (roleName))
throw new ArgumentException ("The specified role name cannot be blank or null");
using (var conn = new NpgsqlConnection(connectionString)) {
conn.Open ();
using (var comm = conn.CreateCommand()) {
//
comm.CommandType = System.Data.CommandType.Text;
comm.CommandText = "select username from usersroles where applicationname = @appname " +
"and rolename = @rolename";
comm.Parameters.AddWithValue ("@rolename", NpgsqlTypes.NpgsqlDbType.Varchar, 255).Value = roleName;
comm.Parameters.AddWithValue ("@appname", NpgsqlTypes.NpgsqlDbType.Varchar, 255).Value = applicationName;
using (var reader = comm.ExecuteReader()) {
var r = new List<string> ();
var usernameColumn = reader.GetOrdinal ("username");
while (reader.Read()) {
r.Add (reader.GetString (usernameColumn));
}
return r.ToArray ();
}
}
}
}
/// <Docs>To be added.</Docs>
/// <summary>
/// Determines whether this instance is user in role the specified username roleName.
/// </summary>
/// <returns><c>true</c> if this instance is user in role the specified username roleName; otherwise, <c>false</c>.</returns>
/// <param name="username">Username.</param>
/// <param name="roleName">Role name.</param>
public override bool IsUserInRole (string username, string roleName)
{
if (username == null || roleName == null)
throw new ArgumentNullException ();
if (username.Trim () == string.Empty)
throw new ArgumentException ("The specified username cannot be blank.");
if (roleName.Trim () == string.Empty)
throw new ArgumentException ("The specified role name cannot be blank.");
using (var conn = new NpgsqlConnection(connectionString)) {
conn.Open ();
using (var comm = conn.CreateCommand()) {
//
comm.CommandType = System.Data.CommandType.Text;
comm.CommandText = "select count(*)>0 from usersroles where applicationname = @appname " +
"and username = @username and rolename = @rolename";
comm.Parameters.AddWithValue ("@username", username);
comm.Parameters.AddWithValue ("@rolename", roleName);
comm.Parameters.AddWithValue ("@appname", applicationName);
var retval = (bool)comm.ExecuteScalar ();
return retval;
}
}
}
/// <Docs>To be added.</Docs>
/// <summary>
/// Removes the users from roles.
/// </summary>
/// <param name="usernames">Usernames.</param>
/// <param name="roleNames">Role names.</param>
public override void RemoveUsersFromRoles (string[] usernames, string[] roleNames)
{
if (usernames.Any (x => x == null) || roleNames.Any (x => x == null)) {
throw new ArgumentNullException ();
}
if (usernames.Any (x => x.Trim () == string.Empty) || (roleNames.Any (x => x.Trim () == string.Empty))) {
throw new ArgumentException ("One or more of the supplied usernames or role names are empty.");
}
using (var conn = new NpgsqlConnection(connectionString)) {
conn.Open ();
using (var comm = conn.CreateCommand()) {
comm.CommandType = System.Data.CommandType.Text;
comm.CommandText = "delete from usersroles where applicationname = @appname and " +
"username = @username and rolename = @rolename";
NpgsqlParameter pu = comm.Parameters.AddWithValue ("@username", NpgsqlTypes.NpgsqlDbType.Varchar, 250);
NpgsqlParameter pr = comm.Parameters.AddWithValue ("@rolename", NpgsqlTypes.NpgsqlDbType.Varchar, 250);
comm.Parameters.AddWithValue ("@appname", NpgsqlTypes.NpgsqlDbType.Varchar, 250).Value = applicationName;
foreach (string rolename in roleNames) {
pr.Value = rolename;
foreach (string username in usernames) {
pu.Value = username;
comm.ExecuteNonQuery ();
}
}
}
}
}
/// <Docs>Tests if a given role name exists.</Docs>
/// <summary>
/// Tests if a given role name exists.
/// </summary>
/// <returns><c>true</c>, if exists was roled, <c>false</c> otherwise.</returns>
/// <param name="roleName">Role name.</param>
public override bool RoleExists (string roleName)
{
using (var conn = new NpgsqlConnection(connectionString)) {
conn.Open ();
using (var comm = new NpgsqlCommand("role_exists", conn)) {
comm.CommandType = System.Data.CommandType.Text;
comm.CommandText = "select Count(*)>0 from roles where applicationname = @applicationname and rolename = @rolename";
comm.Parameters.AddWithValue ("@rolename", NpgsqlTypes.NpgsqlDbType.Varchar, 250).Value = roleName;
comm.Parameters.AddWithValue ("@applicationname", NpgsqlTypes.NpgsqlDbType.Varchar, 250).Value = applicationName;
var retval = (bool)comm.ExecuteScalar ();
return retval;
}
}
}
/// <summary>
/// Gets the name of this provider,
/// should correspond to the item key
/// in the configuration collection of providers.
/// </summary>
/// <value>The name.</value>
public override string Name {
get {
return name;
}
}
/// <summary>
/// Gets the description for this provider.
/// </summary>
/// <value>The description.</value>
public override string Description {
get {
return "PostgreSQL ASP.Net Role Provider class";
}
}
}
}

@ -1,105 +0,0 @@
//
// NpgsqlUserNameProvider.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Collections.Specialized;
using System.Configuration;
namespace Npgsql.Web.RolesAndMembers
{
using Yavsc.Model.RolesAndMembers;
/// <summary>
/// Npgsql user name provider.
/// </summary>
public class NpgsqlUserNameProvider: ChangeUserNameProvider {
private string applicationName;
private string connectionString;
/// <summary>
/// Initialize the specified iname and config.
/// </summary>
/// <param name="iname">Iname.</param>
/// <param name="config">Config.</param>
public override void Initialize (string iname, NameValueCollection config)
{
// get the
// - application name
// - connection string name
// - the connection string from its name
string cnxName = config ["connectionStringName"];
connectionString = ConfigurationManager.ConnectionStrings [cnxName].ConnectionString;
config.Remove ("connectionStringName");
applicationName = config ["applicationName"];
config.Remove ("applicationName");
base.Initialize (iname, config);
}
private string GetConfigValue (string configValue, string defaultValue)
{
if (String.IsNullOrEmpty (configValue))
return defaultValue;
return configValue;
}
#region implemented abstract members of ChangeUserNameProvider
/// <summary>
/// Changes the name.
/// </summary>
/// <param name="oldName">Old name.</param>
/// <param name="newName">New name.</param>
public override void ChangeName (string oldName, string newName)
{
using (NpgsqlConnection conn = new NpgsqlConnection (connectionString)) {
conn.Open ();
using (NpgsqlCommand cmd = new NpgsqlCommand (
"UPDATE users set " +
"username = :uname where username = :oname" +
" AND ApplicationName = :appname ", conn)) {
cmd.Parameters.AddWithValue ("uname", newName);
cmd.Parameters.AddWithValue ("oname", oldName);
cmd.Parameters.AddWithValue ("appname", this.applicationName);
cmd.ExecuteNonQuery ();
}
}
}
/// <summary>
/// Determines whether this instance is name available the specified name.
/// </summary>
/// <returns>true</returns>
/// <c>false</c>
/// <param name="name">Name.</param>
public override bool IsNameAvailable (string name)
{
using (NpgsqlConnection conn = new NpgsqlConnection (connectionString)) {
conn.Open ();
using (NpgsqlCommand cmd = new NpgsqlCommand (
"SELECT count(*)=0 FROM users " +
"WHERE username = :uname AND ApplicationName = :appname", conn)) {
cmd.Parameters.AddWithValue ("uname", name);
cmd.Parameters.AddWithValue ("appname", this.applicationName);
return (bool) cmd.ExecuteScalar ();
}
}
}
#endregion
}
}

@ -1,28 +0,0 @@
-- Table: profiledata
-- DROP TABLE profiledata;
CREATE TABLE profiledata
(
uniqueid integer,
zipcode character varying(10),
cityandstate character varying(255),
avatar bytea,
CONSTRAINT fkprofiles2 FOREIGN KEY (uniqueid)
REFERENCES profiles (uniqueid) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE
)
WITH (
OIDS=FALSE
);
-- Index: fki_fkprofiles2
-- DROP INDEX fki_fkprofiles2;
CREATE INDEX fki_fkprofiles2
ON profiledata
USING btree
(uniqueid );

@ -1,18 +0,0 @@
-- Table: roles
-- DROP TABLE roles;
CREATE TABLE roles
(
rolename character varying(255) NOT NULL,
applicationname character varying(255) NOT NULL,
comment character varying(255) NOT NULL,
CONSTRAINT roles_pkey PRIMARY KEY (rolename , applicationname )
)
WITH (
OIDS=FALSE
);
COMMENT ON TABLE roles
IS 'Web application roles';

@ -1,16 +0,0 @@
-- Table: stocksymbols
-- DROP TABLE stocksymbols;
CREATE TABLE stocksymbols
(
uniqueid integer,
stocksymbol character varying(10),
CONSTRAINT fkprofiles1 FOREIGN KEY (uniqueid)
REFERENCES profiles (uniqueid) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (
OIDS=FALSE
);

@ -1,21 +0,0 @@
-- Table: usersroles
-- DROP TABLE usersroles;
CREATE TABLE usersroles
(
applicationname character varying(255) NOT NULL,
rolename character varying(255) NOT NULL,
username character varying(255) NOT NULL,
CONSTRAINT attrroles_pkey PRIMARY KEY (applicationname , rolename , username ),
CONSTRAINT usersroles_fk_role FOREIGN KEY (applicationname, rolename)
REFERENCES roles (applicationname, rolename) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE,
CONSTRAINT usersroles_fk_user FOREIGN KEY (applicationname, username)
REFERENCES users (applicationname, username) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE
)
WITH (
OIDS=FALSE
);

@ -1,19 +0,0 @@
-- Table: profiles
-- DROP TABLE profiles;
CREATE TABLE profiles
(
uniqueid bigserial NOT NULL,
username character varying(255) NOT NULL,
applicationname character varying(255) NOT NULL,
isanonymous boolean,
lastactivitydate timestamp with time zone,
lastupdateddate timestamp with time zone,
CONSTRAINT profiles_pkey PRIMARY KEY (uniqueid ),
CONSTRAINT pkprofiles UNIQUE (username , applicationname )
)
WITH (
OIDS=FALSE
);

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Npgsql" version="3.0.5" targetFramework="net451" />
</packages>

@ -1,75 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{6A312228-9641-478D-916F-4681CC65A35D}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Presta</RootNamespace>
<AssemblyName>Presta</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Lua|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Lua</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'TotemPre|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\TotemPre</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'TotemProd|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\TotemProd</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'YavscPre|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\YavscPre</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Yavsc|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Yavsc</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'LuaDebug|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Lua</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\yavscModel\YavscModel.csproj">
<Project>{68F5B80A-616E-4C3C-91A0-828AA40000BD}</Project>
<Name>YavscModel</Name>
</ProjectReference>
</ItemGroup>
</Project>

@ -1,47 +0,0 @@
//
// AssemblyInfo.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("Presta")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("GNU GPL")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

@ -1,47 +0,0 @@
yavsc
=====
[doc-fr](http://yavsc.pschneider.fr/Blogs/UserPost/paul/Documentation)
# à faire, par ordre de priorité
-1) Messagerie instantanée : choisir entre directement Google Hangouts API,
SIP, ou Signal R custom
0) Bug fixes :
stocker le token calendar à part
1) Créer un contrôle "bouton utilisateur" `UserNameControl`
avec
* un acces rapide à l'ajout au cercles perso
* pour les administrateur, une action "bloquer",
* le compteur de ses posts publiques
* Si c'est un préstataire, et si on est pas déjà dans un formulaire de reservation,
un lien vers la reservation de ses services
1.2) Concevoir un objet Contact listant les point d'accès par protocol (email, http, sip, irc, téléphone, adresse postale ...)
2) Refabrication de l'Api :
concernant la mise à jour la creation et l'edition d'un post, on
doit pouvoir fondre tout en une seule methode :
* ```long PostFile(BlogEntry be)```,
Utilisée pour la creation quand id est à 0, auquel cas, l'identiffiant
du post créé est renvoyé en retour (non nul).
Sinon, c'est une mise a jour des propriétés
du billet, et on renvoie zero.
Dans tous les cas, toutes les propriétés du post sont fournies car mises à jour,
et on effectue la reception des fichiers attachés.
Dans le cas de l'edition (id non nul),
seules les propriétés spécifiées non nulles sont mises à jour
(NDLR:la visibilité est donc par exemple toujours mis à jour).
4) Terminer l'édition du profile de site, avec la modification
et la suppression des activités et compétences
5) Tester le premier client Android-java libre
6) Tester le premier client Android-xamarin pour iOS

@ -1,27 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("SalesCatalog")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("paul")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

@ -1,122 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{90BF2234-7252-4CD5-B2A4-17501B19279B}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>SalesCatalog</RootNamespace>
<AssemblyName>SalesCatalog</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<DocumentationFile>bin\Debug\SalesCatalog.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Lua|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Lua</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'TotemPre|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\TotemPre</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'TotemProd|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\TotemProd</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'YavscPre|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\YavscPre</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Yavsc|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Yavsc</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'LuaDebug|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Lua</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web" />
<Reference Include="Microsoft.Web.Infrastructure">
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor">
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.Helpers">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Deployment">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Razor">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.Mvc">
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="XmlImplementation\XmlCatalog.cs" />
<Compile Include="Tests\TestCatalogInit.cs" />
<Compile Include="XmlImplementation\XmlCatalogProvider.cs" />
<Compile Include="Tests\TestBrands.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<MonoDevelop>
<Properties>
<Policies>
<DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedFlat" ResourceNamePolicy="FileFormatDefault" />
</Policies>
</Properties>
</MonoDevelop>
</ProjectExtensions>
<ItemGroup>
<None Include="catalog.xsd" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="XmlImplementation\" />
<Folder Include="Tests\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\yavscModel\YavscModel.csproj">
<Project>{68F5B80A-616E-4C3C-91A0-828AA40000BD}</Project>
<Name>YavscModel</Name>
</ProjectReference>
</ItemGroup>
</Project>

@ -1,33 +0,0 @@
#if TEST
using NUnit.Framework;
using System;
namespace SalesCatalog.Tests
{
[TestFixture ()]
public class TestBrands
{
[Test ()]
public void TestCaseAddRemoveBrand ()
{
Catalog c = new Catalog ();
c.Brands = new Brand[0];
Brand b=c.AddBrand ("coko");
if (c.Brands.Length != 1)
throw new Exception ("Pas ajouté");
if (b == null)
throw new Exception ("Renvoyé null");
if (b.Name != "coko")
throw new Exception ("Pas le bon nom");
if (c.Brands [0] != b)
throw new Exception ("err index 0");
if (c.GetBrand ("coko") != b)
throw new Exception ("err get by name");
if (!c.RemoveBrand ("coko"))
throw new Exception ("Pas supprimé");
}
}
}
#endif

@ -1,108 +0,0 @@
#if TEST
using System;
using NUnit.Framework;
using SalesCatalog.XmlImplementation;
using System.Xml.Serialization;
using System.IO;
using System.Xml;
using System.Text;
namespace SalesCatalog.Tests
{
[TestFixture()]
public class TestCatalogInit
{
[Test()]
public void TestSerDeserCat ()
{
Catalog cat = new XmlCatalog ();
Brand b = new Brand ();
b.Logo = new ProductImage ();
b.Logo.Src = "/App_Themes/images/dev.png";
b.Logo.Alt = "Dev";
b.Name = "Developpement à la carte";
b.Slogan = "Votre logiciel, efficace, sûr, et sur mesure";
ProductCategory si = new ProductCategory ();
si.Name = "Systèmes d'information et sites Web";
ProductCategory progiciel = new ProductCategory ();
progiciel.Name = "Progiciels";
b.Categories = new ProductCategory[]{ si, progiciel };
Service simaint = new Service ();
simaint.Name = "Maintenance logicielle";
simaint.Description = "Correction des bugs, évolution";
Service sidev = new Service ();
sidev.Name = "Développement logiciel";
sidev.Description = "Votre intranet, votre site Web, sur mesure, " +
"développé en cycles courts, et en étroite collaboration avec vous";
Service aubb = new Service ();
aubb.Name = "Audit de sécurité en black box";
aubb.Description = "Je recherche les failles de sécurité de votre SI ou site Web, depuis l'exterieur de " +
"votre système, sans avoir eu connaissance d'aucun élément sur l'architécture de votre " +
"système";
Service auwb = new Service ();
auwb.Name = "Audit de sécurité en white box";
auwb.Description = "Je me déplace chez vous, pour travailler à partir de votre code source, " +
"et isoler ses failles de sécurités";
si.Products = new Product[] { simaint, sidev, aubb, auwb };
Service maint = new Service ();
maint.Name = "Maintenance logicielle";
maint.Description = "Correction des bugs, évolution";
Service dev = new Service ();
dev.Name = "Développement logiciel";
dev.Description = "Votre progiciel, sur mesure, " +
"développé en cycles courts, et en étroite collaboration avec vous";
progiciel.Products = new Product[] { maint, dev };
SaleForm f = new SaleForm ();
f.Action = "/testAction";
TextInput ticat = new TextInput ("Choose a Title");
ticat.Id = "title" ;
ticat.MultiLine = true;
SelectInput selSize = new SelectInput ();
selSize.Id="size";
Option o1 = new Option ();
o1.Value = "1m"; o1.Text = "1 mois";
Option o2 = new Option ();
o2.Value = "2m"; o2.Text = "2 mois";
Option o3 = new Option ();
o3.Value = "6m"; o3.Text = "6 mois";
selSize.Items = new Option [] { o1, o2, o3 };
var txt1 = new Text ();
var txt2 = new Text ();
txt1.Val="Choose a title : ";
txt2.Val = "[br]Choose the size : ";
f.Items = new FormElement[] {txt1,ticat,txt2,selSize};
b.DefaultForm = f;
cat.Brands = new Brand[] { b };
b.Categories = new ProductCategory[] { si, progiciel };
XmlSerializer ser =
new XmlSerializer
(typeof(XmlCatalog),
new Type[]{typeof(Service),
typeof(PhysicalProduct),
typeof(Euro),
typeof(TextInput),
typeof(SalesCatalog.Model.Text),
typeof(TextInput),
typeof(SelectInput)
});
FileInfo fi = new FileInfo ("Catalog.xml");
if (fi.Exists)
fi.Delete ();
using (FileStream ws = fi.OpenWrite()) {
ser.Serialize (ws, cat);
}
using (FileStream rs = fi.OpenRead()) {
using (XmlTextReader rdr = new XmlTextReader(rs)) {
XmlCatalog copy = (XmlCatalog)ser.Deserialize (rdr);
if (copy.Brands == null) throw new Exception("Null brand array!");
if (copy.Brands.Length != cat.Brands.Length) throw new Exception("Not the same count of brands");
if (copy.Brands[0].DefaultForm.Action != cat.Brands[0].DefaultForm.Action) throw new Exception("not the same default form");
// ...
}
}
}
}
}
#endif

@ -1,23 +0,0 @@
using System;
using System.Xml.Serialization;
using Yavsc.Model.FrontOffice.Catalog;
namespace SalesCatalog.XmlImplementation
{
/// <summary>
/// Xml catalog.
/// Inherits of the Catalog class,
/// to make it serializable from and to Xml
/// </summary>
[XmlRoot]
public class XmlCatalog : Catalog
{
/// <summary>
/// Initializes a new instance of the <see cref="SalesCatalog.XmlImplementation.XmlCatalog"/> class.
/// </summary>
public XmlCatalog ()
{
}
}
}

@ -1,135 +0,0 @@
using System;
using System.Xml.Serialization;
using System.Configuration;
using System.IO;
using System.Xml;
using System.Web;
using Yavsc.Model.FrontOffice.Catalog;
namespace SalesCatalog.XmlImplementation
{
/// <summary>
/// Xml catalog provider.
/// In charge of getting the catalog data,
/// returning a Catalog object from GetCatalog
/// </summary>
public class XmlCatalogProvider: CatalogProvider
{
#region implemented abstract members of CatalogProvider
/// <summary>
/// Gets the activity.
/// </summary>
/// <returns>The activity.</returns>
/// <param name="MEACode">MAE code.</param>
public override Yavsc.Model.FrontOffice.Activity GetActivity (string MEACode)
{
throw new NotImplementedException ();
}
/// <summary>
/// Registers the activity.
/// </summary>
/// <param name="activityName">Activity name.</param>
/// <param name="meacode">Meacode.</param>
/// <param name="comment">Comment.</param>
public override void RegisterActivity (string activityName, string meacode, string comment)
{
throw new NotImplementedException ();
}
/// <summary>
/// Finds the activity.
/// </summary>
/// <returns>The activity.</returns>
/// <param name="pattern">Pattern.</param>
/// <param name="exerted">If set to <c>true</c> exerted.</param>
public override Yavsc.Model.FrontOffice.Activity[] FindActivity (string pattern, bool exerted)
{
throw new NotImplementedException ();
}
/// <summary>
/// Finds the performer.
/// </summary>
/// <returns>The performer.</returns>
/// <param name="MEACode">MEA code.</param>
public override Yavsc.Model.FrontOffice.PerformerProfile[] FindPerformer (string MEACode)
{
throw new NotImplementedException ();
}
/// <summary>
/// Gets the catalog, loading it from
/// the file system at a first call,
/// and when its last write time has changed.
/// </summary>
/// <returns>The catalog.</returns>
public override Catalog GetCatalog ()
{
// Assert fileName != null
FileInfo fi = new FileInfo (fileName);
if (!fi.Exists)
throw new ConfigurationErrorsException(
string.Format("No catalog found ({0})",fileName));
if (fi.LastWriteTime > lastModification)
LoadCatalog ();
return catInstance;
}
/// <summary>
/// The catalog instance.
/// </summary>
protected XmlCatalog catInstance = null;
/// <summary>
/// The last modification date of the file loaded.
/// </summary>
protected DateTime lastModification = new DateTime(0);
/// <summary>
/// The name of the file loaded.
/// </summary>
protected string fileName = null;
#endregion
/// <summary>
/// Initialize the catalog
/// using the specified name and config.
/// The config object contains under the key
/// <c>connection</c> the path to the Xml Catalog file
/// at server side.
/// </summary>
/// <param name="name">Name.</param>
/// <param name="config">Config.</param>
public override void Initialize (string name, System.Collections.Specialized.NameValueCollection config)
{
if (config ["connection"] == null)
throw new Exception ("the 'connection' parameter is null " +
"(it should be the absolute path to the xml catalog)");
string cnx = (string) config ["connection"];
fileName = HttpContext.Current.Server.MapPath(cnx);
LoadCatalog ();
}
private void LoadCatalog ()
{
try {
FileInfo fi = new FileInfo (fileName);
if (!fi.Exists)
throw new Exception (
string.Format ("Le fichier Xml decrivant le catalogue n'existe pas ({0})", fi.FullName));
XmlSerializer xsr = new XmlSerializer (typeof(XmlCatalog),new Type[]{
typeof(Service),
typeof(PhysicalProduct),
typeof(Euro),
typeof(Text),
typeof(TextInput),
typeof(SelectInput)});
using (FileStream fs = fi.OpenRead()) {
catInstance = (XmlCatalog) xsr.Deserialize (fs);
}
fileName = fi.FullName;
lastModification = fi.LastWriteTime;
}
catch (Exception e) {
lastModification = new DateTime (0);
throw e;
}
}
}
}

@ -1,151 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Catalog" nillable="true" type="Catalog" />
<xs:complexType name="Catalog">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="Brands" type="ArrayOfBrand" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="ArrayOfBrand">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="Brand" nillable="true" type="Brand" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="Brand">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="Name" type="xs:string" />
<xs:element minOccurs="0" maxOccurs="1" name="Slogan" type="xs:string" />
<xs:element minOccurs="0" maxOccurs="1" name="Url" type="xs:string" />
<xs:element minOccurs="0" maxOccurs="1" name="Categories" type="ArrayOfProductCategory" />
<xs:element minOccurs="0" maxOccurs="1" name="DefaultForm" type="ArrayOfFormElement" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="ArrayOfProductCategory">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="ProductCategory" nillable="true" type="ProductCategory" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="ProductCategory">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="Products" type="ArrayOfProduct" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="ArrayOfProduct">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="Product" nillable="true" type="Product" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="Product" />
<xs:complexType name="ArrayOfFormElement">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="FormElement" nillable="true" type="FormElement" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="FormElement" />
<xs:element name="Brand" nillable="true" type="Brand" />
<xs:element name="Product" nillable="true" type="Product" />
<xs:element name="Currency" nillable="true" type="Currency" />
<xs:complexType name="Currency">
<xs:complexContent mixed="false">
<xs:extension base="Unit" />
</xs:complexContent>
</xs:complexType>
<xs:complexType name="Unit" />
<xs:element name="ArrayOfFormElement" nillable="true" type="ArrayOfFormElement" />
<xs:element name="FormInput" nillable="true" type="FormInput" />
<xs:complexType name="FormInput">
<xs:complexContent mixed="false">
<xs:extension base="FormElement">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="Id" type="xs:string" />
<xs:element minOccurs="0" maxOccurs="1" name="Value" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="TextInput" nillable="true" type="TextInput" />
<xs:complexType name="TextInput">
<xs:complexContent mixed="false">
<xs:extension base="FormElement" />
</xs:complexContent>
</xs:complexType>
<xs:element name="SelectInput" nillable="true" type="SelectInput" />
<xs:complexType name="SelectInput">
<xs:complexContent mixed="false">
<xs:extension base="FormElement" />
</xs:complexContent>
</xs:complexType>
<xs:element name="Label" nillable="true" type="Label" />
<xs:complexType name="Label">
<xs:complexContent mixed="false">
<xs:extension base="FormElement" />
</xs:complexContent>
</xs:complexType>
<xs:element name="Comment" nillable="true" type="Comment" />
<xs:complexType name="Comment">
<xs:complexContent mixed="false">
<xs:extension base="FormElement" />
</xs:complexContent>
</xs:complexType>
<xs:element name="CheckBox" nillable="true" type="CheckBox" />
<xs:complexType name="CheckBox">
<xs:complexContent mixed="false">
<xs:extension base="FormInput" />
</xs:complexContent>
</xs:complexType>
<xs:element name="RadioButton" nillable="true" type="RadioButton" />
<xs:complexType name="RadioButton">
<xs:complexContent mixed="false">
<xs:extension base="FormInput">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="Choice" type="xs:string" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="Link" nillable="true" type="Link" />
<xs:complexType name="Link">
<xs:complexContent mixed="false">
<xs:extension base="FormElement" />
</xs:complexContent>
</xs:complexType>
<xs:element name="FilesInput" nillable="true" type="FilesInput" />
<xs:complexType name="FilesInput">
<xs:complexContent mixed="false">
<xs:extension base="FormInput" />
</xs:complexContent>
</xs:complexType>
<xs:element name="FormElement" nillable="true" type="FormElement" />
<xs:element name="Unit" nillable="true" type="Unit" />
<xs:element name="Value" nillable="true" type="Value" />
<xs:complexType name="Value">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="Quantity" />
<xs:element minOccurs="0" maxOccurs="1" name="Unit" type="Unit" />
</xs:sequence>
</xs:complexType>
<xs:element name="Image" nillable="true" type="Image" />
<xs:complexType name="Image">
<xs:complexContent mixed="false">
<xs:extension base="FormElement">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="Src" type="xs:string" />
<xs:element minOccurs="0" maxOccurs="1" name="Alt" type="xs:string" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="ProductCategory" nillable="true" type="ProductCategory" />
<xs:element name="Price" nillable="true" type="Price" />
<xs:complexType name="Price">
<xs:complexContent mixed="false">
<xs:extension base="Value" />
</xs:complexContent>
</xs:complexType>
<xs:element name="Euro" nillable="true" type="Euro" />
<xs:complexType name="Euro">
<xs:complexContent mixed="false">
<xs:extension base="Currency" />
</xs:complexContent>
</xs:complexType>
</xs:schema>

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net451" />
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net451" />
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net451" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net451" />
</packages>

@ -1,52 +0,0 @@
//
// AllTests.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using NUnit.Framework;
using System;
using Yavsc.Model.Blogs;
using Yavsc.Controllers;
using System.Web.Mvc;
using System.Web.Security;
using System.Web.Configuration;
using System.Configuration;
using System.IO;
using System.Web.Http;
using Mono.WebServer;
using System.Net;
using System.Collections;
namespace Yavsc
{
public class AllTests
{
[Suite]
public static IEnumerable Suite
{
get
{
ArrayList suite = new ArrayList ();
suite.Add(new BlogUnitTestCase());
return suite;
}
}
}
}

@ -1,52 +0,0 @@
//
// TagTestCases.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using NUnit.Framework;
using System;
using Yavsc.Model.Blogs;
namespace Yavsc
{
[TestFixture ()]
public class BlogUnitTestCase: ServerTestCase
{
[TestFixtureSetUp]
void NeedAPost()
{
Register ();
}
[Test ()]
public void TestCase ()
{
long pid = BlogManager.Post (UserName, "BlogUnitTestCase", "content", true, null);
BlogManager.Tag (pid, "test");
}
[TestFixtureTearDown()]
void Cleanup()
{
Unregister ();
}
}
}

@ -1,51 +0,0 @@
//
// DebugServer.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using NUnit.Framework;
using System.Net;
using Mono.WebServer.XSP;
namespace Mono.WebServer.Test
{
public class DebugServer : IDisposable
{
#region IDisposable implementation
public void Dispose ()
{
// would have a sense when managing the Xsp server instance:
// server.Stop();
}
#endregion
string physicalPath = @"/home/paul/workspace/totem/web/";
public int Run ()
{
return Server.Main (new [] { "--applications", "/:"+physicalPath, "--port", "8080", "--nonstop" });
}
}
}

@ -1,73 +0,0 @@
//
// HelloWorld.cs
//
//
// HelloWorld.cs
//
// Author:
// Leonardo Taglialegne <leonardo.taglialegne@gmail.com>
//
// Copyright (c) 2013 Leonardo Taglialegne.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using NUnit.Framework;
using System.Net;
using Mono.WebServer.XSP;
namespace Mono.WebServer.Test
{
[TestFixture]
public class HelloWorld
{
[Test]
public void TestCase ()
{
using (var server = new DebugServer()) {
Assert.AreEqual (0, server.Run ());
var wc = new WebClient ();
try {
string downloaded = wc.DownloadString ("http://localhost:8080/");
//Assert.AreEqual (Environment.CurrentDirectory, downloaded);
// ResponseHeaders {
// Date: Thu, 15 Oct 2015 16:12:00 GMT
// Server: Mono.WebServer.XSP/3.8.0.0 Linux
// X-AspNetMvc-Version: 3.0
// X-AspNet-Version: 4.0.30319
// Content-Length: 2180
// Cache-Control: private
// Content-Type: text/html
// Set-Cookie: ASP.NET_SessionId=ED208D636A4312B9745E396D; path=/
// Keep-Alive: timeout=15, max=100
// Connection: Keep-Alive } System.Net.WebHeaderCollection
Assert.Greater(wc.ResponseHeaders["Set-Cookie"].Length, 10);
} catch (WebException e) {
Assert.Fail (e.Message);
}
}
}
}
}

@ -1,47 +0,0 @@
//
// AssemblyInfo.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("TestAPI")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("GNU GPL")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

@ -1,151 +0,0 @@
//
// BlogUnitTest.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using NUnit.Framework;
using System;
using Yavsc.Model.Blogs;
using Yavsc.Controllers;
using System.Web.Mvc;
using System.Web.Security;
using System.Web.Configuration;
using System.Configuration;
using System.IO;
using System.Web.Http;
using Mono.WebServer;
using System.Net;
using System.Web.Hosting;
using Mono.Web.Util;
using Mono.WebServer.Options;
namespace Yavsc
{
[TestFixture ()]
public class ServerTestCase
{
public string UserName { get; set; }
public string Email { get; set; }
public string Password { get; set; }
AccountController accountController;
public AccountController AccountController {
get {
return accountController;
}
}
ApplicationServer WebAppServer;
string defaultMembershipProvider = null;
[Test]
public virtual void Start()
{
// get the web config
string physicalPath = @"/home/paul/workspace/totem/web/";
string physicalPathToConfig = physicalPath + "/Web.config";
ExeConfigurationFileMap exemap = new ExeConfigurationFileMap ();
exemap.ExeConfigFilename = physicalPathToConfig ;
Configuration config = System.Configuration.ConfigurationManager.OpenMappedExeConfiguration (exemap, ConfigurationUserLevel.None);
string basedir = AppDomain.CurrentDomain.BaseDirectory;
string curdir = Directory.GetCurrentDirectory ();
string dummyVirtualPath = "/";
int Port=8080;
XSPWebSource websource=new XSPWebSource(IPAddress.Any,Port);
WebAppServer=new ApplicationServer(websource,physicalPath);
var broker = new XSPRequestBroker ();
var host = new XSPApplicationHost ();
host.RequestBroker = broker;
host.Server = WebAppServer;
broker.InitializeLifetimeService ();
host.InitializeLifetimeService ();
// ApplicationHost h = new XSPApplicationHost();
//"[[hostname:]port:]VPath:realpath"
string cmdLine=Port+":/:"+physicalPath;
WebAppServer.AddApplicationsFromCommandLine (cmdLine);
WebAppServer.Broker = broker;
WebAppServer.AppHost = host;
// WebAppServer.AddApplicationsFromConfigFile (physicalPath+"/Web.config");
// WebConfigurationFileMap map = new WebConfigurationFileMap ();
// map.VirtualDirectories.Add (dummyVirtualPath, new VirtualDirectoryMapping (physicalPath, true));
// TODO why not? Configuration configuration = WebConfigurationManager.OpenMappedWebConfiguration (map, dummyVirtualPath);
// string da = (string)config.AppSettings.Settings ["DefaultAvatar"].Value;
// MembershipSection s = config.GetSection ("system.web/membership") as MembershipSection;
// defaultMembershipProvider = s.DefaultProvider;
// ??? WebConfigurationManager.ConfigPath
Configuration cfg = WebConfigurationManager.OpenWebConfiguration (dummyVirtualPath);
// WebConfigurationManager.AppSettings.Clear ();
// WebConfigurationManager.ConnectionStrings.Clear ();
// var mbrssect = WebConfigurationManager.GetWebApplicationSection ("system.web/membership") as MembershipSection;
//
// mbrssect.Providers.Clear ();
var syswebcfg = WebConfigurationManager.GetWebApplicationSection ("system.web") as ConfigurationSection;
WebAppServer.Start (true,2000);
// System.Threading.Thread.Sleep(30000);
}
[Test ()]
public virtual void Register ()
{
accountController = new AccountController ();
ViewResult actionResult = accountController.Register (
new Yavsc.Model.RolesAndMembers.RegisterViewModel () {
UserName = UserName, Email = Email,
Password = "tpwd", ConfirmPassword = Password,
IsApprouved = true
},
"/testreturnurl") as ViewResult;
Assert.AreSame ("",actionResult.ViewName);
MembershipUser u = Membership.GetUser (UserName, false);
Assert.NotNull (u);
Assert.False (u.IsApproved);
// TODO : check mail for test,
// get the validation key from its body,
// and use the accountController.Validate(username,key)
u.IsApproved = true;
Membership.UpdateUser (u);
Assert.True (u.IsApproved);
}
[Test()]
public virtual void Stop() {
WebAppServer.Stop();
}
public virtual void Unregister()
{
ViewResult actionResult =
accountController.Unregister (UserName, true) as ViewResult;
Assert.AreEqual (actionResult.ViewName, "Index");
}
}
}

@ -1,184 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{42B77C89-BF6D-4DB1-8763-6197F4030A95}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>TestAPI</RootNamespace>
<AssemblyName>TestAPI</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Lua|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Lua</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'TotemPre|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\TotemPre</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'TotemProd|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\TotemProd</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'YavscPre|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\YavscPre</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Yavsc|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Yavsc</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'LuaDebug|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Lua</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="Machine.Specifications">
<HintPath>..\packages\Machine.Specifications.0.9.3\lib\net45\Machine.Specifications.dll</HintPath>
</Reference>
<Reference Include="Machine.Specifications.Clr4">
<HintPath>..\packages\Machine.Specifications.0.9.3\lib\net45\Machine.Specifications.Clr4.dll</HintPath>
</Reference>
<Reference Include="Machine.Specifications.Runner.Utility">
<HintPath>..\packages\Machine.Specifications.Runner.Utility.0.9.0\lib\net45\Machine.Specifications.Runner.Utility.dll</HintPath>
</Reference>
<Reference Include="Machine.Specifications.Should">
<HintPath>..\packages\Machine.Specifications.Should.0.8.0\lib\net45\Machine.Specifications.Should.dll</HintPath>
</Reference>
<Reference Include="Machine.Specifications.Reporting">
<HintPath>..\packages\Machine.Specifications.Reporting.0.9.1\lib\net45\Machine.Specifications.Reporting.dll</HintPath>
</Reference>
<Reference Include="Machine.Specifications.Reporting.Templates">
<HintPath>..\packages\Machine.Specifications.Reporting.0.9.1\lib\net45\Machine.Specifications.Reporting.Templates.dll</HintPath>
</Reference>
<Reference Include="Spark">
<HintPath>..\packages\Spark.1.8.1.0\lib\NET45\Spark.dll</HintPath>
</Reference>
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Web" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Routing" />
<Reference Include="System.Web.Abstractions" />
<Reference Include="System.Security" />
<Reference Include="System.Net" />
<Reference Include="Mono.WebServer2">
<HintPath>..\..\..\..\..\usr\lib\mono\4.5\Mono.WebServer2.dll</HintPath>
</Reference>
<Reference Include="xsp4">
<HintPath>..\..\..\..\..\usr\lib\mono\4.5\xsp4.exe</HintPath>
</Reference>
<Reference Include="Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="Microsoft.Web.XmlTransform, Version=1.0.0.0, Culture=neutral">
<Package>nuget-core</Package>
</Reference>
<Reference Include="Microsoft.Build.Utilities.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.3.0.1\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.Infrastructure">
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor">
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.Helpers">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Deployment">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Razor">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.Mvc">
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Formatting">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http" />
<Reference Include="System.Web.Http">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http.WebHost">
<HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.8.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TestAutomate.cs" />
<Compile Include="BlogUnitTestCase.cs" />
<Compile Include="TestByteA.cs" />
<Compile Include="HelloWorld.cs" />
<Compile Include="ServerTestCase.cs" />
<Compile Include="DebugServer.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\yavscModel\YavscModel.csproj">
<Project>{68F5B80A-616E-4C3C-91A0-828AA40000BD}</Project>
<Name>YavscModel</Name>
</ProjectReference>
<ProjectReference Include="..\NpgsqlBlogProvider\NpgsqlBlogProvider.csproj">
<Project>{C6E9E91B-97D3-48D9-8AA7-05356929E162}</Project>
<Name>NpgsqlBlogProvider</Name>
</ProjectReference>
<ProjectReference Include="..\NpgsqlContentProvider\NpgsqlContentProvider.csproj">
<Project>{821FF72D-9F4B-4A2C-B95C-7B965291F119}</Project>
<Name>NpgsqlContentProvider</Name>
</ProjectReference>
<ProjectReference Include="..\NpgsqlMRPProviders\NpgsqlMRPProviders.csproj">
<Project>{BBA7175D-7F92-4278-96FC-84C495A2B5A6}</Project>
<Name>NpgsqlMRPProviders</Name>
</ProjectReference>
<ProjectReference Include="..\SalesCatalog\SalesCatalog.csproj">
<Project>{90BF2234-7252-4CD5-B2A4-17501B19279B}</Project>
<Name>SalesCatalog</Name>
</ProjectReference>
<ProjectReference Include="..\web\Yavsc.csproj">
<Project>{77044C92-D2F1-45BD-80DD-AA25B311B027}</Project>
<Name>Yavsc</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="test-domain-TestAPI.config">
<Gettext-ScanForTranslations>False</Gettext-ScanForTranslations>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

@ -1,69 +0,0 @@
//
// MyClass.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using Machine.Specifications;
using Yavsc.Model.WorkFlow;
using NUnit.Framework;
namespace TestAPI
{
[Subject(typeof(Automate<int,int>),"simple automate")]
public class CreatingAnAutomate
{
static Automate<int,int> Subject;
/// <summary>
/// The context.
/// </summary>
Establish context = () =>
{
// ... any mocking, stubbing, or other setup ...
Subject = new Automate<int,int>();
};
Because of = () => Subject.AddTransition(0,1,'a');
/// <summary>
/// The should be in state 0.
/// </summary>
It should_be_in_state_0 = () => Subject.State.ShouldEqual(0);
/// <summary>
/// The should not be in state 1.
/// </summary>
It should_not_be_in_state_1 = () => Subject.State.ShouldNotEqual(1);
/// <summary>
/// The state of the should not indicate o as final.
/// </summary>
It should_not_indicate_O_as_final_state = () => Subject.IsInFinalState().ShouldNotEqual(true);
[Test]
public void DoTheTest()
{
// Establish
context.Invoke ();
// Because
of.Invoke ();
should_be_in_state_0.Invoke ();
should_not_be_in_state_1.Invoke ();
should_not_indicate_O_as_final_state.Invoke ();
}
}
}

@ -1,90 +0,0 @@
#if TEST
using NUnit.Framework;
using System;
using Npgsql;
using System.Web.Configuration;
namespace Yavsc
{
[TestFixture ()]
public class TestByteA: IDisposable
{
string cnxName = "yavsc";
string ConnectionString { get {
return "Server=127.0.0.1;Port=5432;Database=YavscDev;User Id=yavscdev;Password=admin;Encoding=Unicode;" ;
// Why? not this : return WebConfigurationManager.ConnectionStrings [cnxName].ConnectionString;
} }
[TestFixtureSetUp]
public void Init()
{
// create the table
Console.WriteLine ("cnx:"+ConnectionString);
using (NpgsqlConnection cnx = new NpgsqlConnection (ConnectionString))
{
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "drop table _testbytea";
try { cmd.ExecuteNonQuery (); }
catch (NpgsqlException) {
}
cmd.CommandText = "create table _testbytea( t bytea )";
cmd.ExecuteNonQuery ();
}
}
}
[Test(Description="Test storing a byte array in a Postgresql table field")]
public void TestStoreByteA ()
{
byte []a = new byte[3];
a[0]=1;
a[1]=2;
a[2]=3;
using (NpgsqlConnection cnx = new NpgsqlConnection (ConnectionString)) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ())
{
cmd.CommandText = "insert into _testbytea (t) values (@tv)";
cmd.Parameters.AddWithValue ("@tv", a);
cmd.ExecuteNonQuery ();
}
using (NpgsqlCommand cmd = cnx.CreateCommand ())
{
cmd.CommandText = "select t from _testbytea";
cmd.Parameters.AddWithValue ("@tv", a);
NpgsqlDataReader rdr = cmd.ExecuteReader ();
if (!rdr.Read ())
throw new Exception ("Read failed");
int i = rdr.GetOrdinal ("t");
byte []rded = (byte[]) rdr.GetValue (i);
if (rded.Length!=a.Length)
throw new Exception("Lengthes don't match");
}
}
}
#region IDisposable implementation
[TestFixtureTearDown]
public void Dispose ()
{
// drop the table
using (NpgsqlConnection cnx = new NpgsqlConnection (ConnectionString)) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "drop table _testbytea";
cmd.ExecuteNonQuery ();
}
}
}
#endregion
}
}
#endif

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Machine.Specifications" version="0.9.3" targetFramework="net45" />
<package id="Machine.Specifications.Reporting" version="0.9.1" targetFramework="net45" />
<package id="Machine.Specifications.Runner.Utility" version="0.9.0" targetFramework="net45" />
<package id="Machine.Specifications.Should" version="0.8.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net451" />
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net451" />
<package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net451" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net451" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net451" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net451" />
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net451" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net451" />
<package id="Newtonsoft.Json" version="8.0.1" targetFramework="net451" />
<package id="NUnit" version="3.0.1" targetFramework="net451" />
<package id="Spark" version="1.8.1.0" targetFramework="net45" />
</packages>

@ -1,124 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
</sectionGroup>
</sectionGroup>
</sectionGroup>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
<sectionGroup name="system.web">
<section name="membership" type="System.Web.Configuration.MembershipSection, System.Web" />
<section name="blog" type="Yavsc.Model.DataProviderConfigurationSection, YavscModel" allowLocation="true" requirePermission="false" allowDefinition="Everywhere" />
<section name="thanks" type="Yavsc.ThanksConfigurationSection, Yavsc" allowLocation="true" requirePermission="false" allowDefinition="Everywhere" />
<section name="catalog" type="Yavsc.Model.FrontOffice.Configuration.CatalogProvidersConfigurationSection, YavscModel" allowLocation="true" requirePermission="false" allowDefinition="Everywhere" />
<section name="workflow" type="Yavsc.Model.DataProviderConfigurationSection, YavscModel" allowLocation="true" requirePermission="false" allowDefinition="Everywhere" />
<section name="circleProviders" type="Yavsc.Model.DataProviderConfigurationSection, YavscModel" />
<section name="userNameManager" type="Yavsc.Model.DataProviderConfigurationSection, YavscModel" />
</sectionGroup>
<section name="paypal" type="PayPal.SDKConfigHandler, PayPal" />
</configSections>
<system.data>
<DbProviderFactories>
<add name="Npgsql Data Provider" invariant="Npgsql" support="FF" description=".Net Framework Data Provider for Postgresql Server" type="Npgsql.NpgsqlFactory, Npgsql" />
</DbProviderFactories>
</system.data>
<system.web>
<authentication mode="Forms" >
<forms loginUrl="login.aspx"
name=".ASPXFORMSAUTH" />
</authentication>
<authorization>
<deny users="?" />
</authorization>
<membership defaultProvider="NpgsqlMembershipProvider" userIsOnlineTimeWindow="1">
<providers>
<clear />
<add name="NpgsqlMembershipProvider" type="Npgsql.Web.NpgsqlMembershipProvider, NpgsqlMRPProviders"
connectionStringName="yavsc" enablePasswordRetrieval="false"
enablePasswordReset="true" requiresQuestionAndAnswer="false"
requiresUniqueEmail="true" passwordFormat="Clear" maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10" applicationName="/" autogenerateschema="false" />
</providers>
</membership>
<roleManager enabled="true" defaultProvider="NpgsqlRoleProvider">
<providers>
<clear />
<add name="NpgsqlRoleProvider" connectionStringName="yavsc" applicationName="/" type="Npgsql.Web.NpgsqlRoleProvider, NpgsqlMRPProviders" autogenerateschema="false" />
</providers>
</roleManager>
<userNameManager defaultProvider="NpsqlUserNameProvider">
<providers>
<add name="NpsqlUserNameProvider" connectionStringName="yavsc" applicationName="/" type="Npgsql.Web.RolesAndMembers.NpgsqlUserNameProvider, NpgsqlMRPProviders" autogenerateschema="false">
</add>
</providers>
</userNameManager>
<workflow defaultProvider="ITProvider">
<providers>
<clear />
<add name="ITProvider" type="Yavsc.ITCPNpgsqlProvider, ITContentProvider" applicationName="/" connectionStringName="yavsc" />
</providers>
</workflow>
<profile defaultProvider="NpgsqlProfileProvider">
<providers>
<clear />
<add name="NpgsqlProfileProvider" type="Npgsql.Web.NpgsqlProfileProvider, NpgsqlMRPProviders" connectionStringName="yavsc" applicationName="/" description="ProfileProvider for yavsc" />
</providers>
<properties>
<add name="Name" />
<add name="Phone" />
<add name="Mobile" />
<add name="Avatar" />
<add name="BlogVisible" type="System.Boolean" />
<add name="BlogTitle" />
<add name="WebSite" />
<add name="Address" />
<add name="CityAndState" />
<add name="ZipCode" />
<add name="Country" />
<add name="BankCode" />
<add name="IBAN" />
<add name="BIC" />
<add name="WicketCode" />
<add name="AccountNumber" />
<add name="BankedKey" />
<add name="gtoken" />
<add name="grefreshtoken" />
<add name="gtokentype" />
<add name="gtokenexpir" type="System.DateTime"/>
<add name="gcalapi" type="System.Boolean"/>
<add name="gcalid" />
<add name="gregid" />
</properties>
</profile>
<blog defaultProvider="NpgsqlBlogProvider">
<providers>
<add name="NpgsqlBlogProvider" connectionStringName="yavsc" applicationName="/" type="Npgsql.Web.Blog.NpgsqlBlogProvider, NpgsqlBlogProvider" />
</providers>
</blog>
</system.web>
<connectionStrings>
<add name="yavsc" connectionString="Server=127.0.0.1;Port=5432;Database=totem;User Id=totemweb;Password=cZeoft2k5_d4;" providerName="Npgsql" />
</connectionStrings>
<appSettings>
<add key="MonoServerDefaultIndexFiles" value="index.html,Index.aspx" />
<add key="WorkflowContentProviderClass" value="yavsc.NpgsqlContentProvider" />
<add key="SmtpServer" value="smtp.free.fr" />
<add key="AdminEMail" value="paulschneider@free.fr" />
<add key="OwnerEMail" value="" />
<add key="Name" value="TOTEM PRODUCTION" />
<add key="DefaultController" value="Home" />
<add key="DefaultAvatar" value="/App_Themes/images/noavatar.png;image/png" />
<add key="RegistrationMessage" value="/RegistrationMail.txt" />
<!-- <add key="ClientValidationEnabled" value="true" /> -->
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="PayPalLogger" value="PayPal.Log.Log4netLogger" />
</appSettings>
</configuration>

@ -1,174 +0,0 @@
//
// InputCircle.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Web;
using System.Security.Permissions;
using System.Web.UI;
using System.ComponentModel;
using System.Web.UI.WebControls;
using Yavsc.Model.Circles;
using System.Web.Security;
using System.Collections;
using System.Collections.Generic;
using System.Web.Mvc;
using System.Linq;
namespace Yavsc.WebControls
{
/// <summary>
/// Input circle.
/// </summary>
[
AspNetHostingPermission (SecurityAction.Demand,
Level = AspNetHostingPermissionLevel.Minimal),
AspNetHostingPermission (SecurityAction.InheritanceDemand,
Level = AspNetHostingPermissionLevel.Minimal),
ParseChildren (true),
DefaultProperty ("Name"),
ToolboxData ("<{0}:InputCircle runat=\"server\"> </{0}:InputCircle>")
]
public class InputCircle: WebControl
{
/// <summary>
/// Initializes a new instance of the <see cref="WebControls.InputCircle"/> class.
/// </summary>
public InputCircle ()
{
}
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
[Bindable (true), DefaultValue(""), Localizable(true)]
public string Name {
get {
return (string) ViewState["Name"];
}
set {
ViewState ["Name"] = value;
}
}
/// <summary>
/// Gets or sets the The CircleInfo collection.
/// </summary>
/// <value>The value.</value>
[Bindable (true), DefaultValue(null), Localizable(true),
Category("Behavior"),
Description("The CircleInfo collection"),
DesignerSerializationVisibility(
DesignerSerializationVisibility.Content),
PersistenceMode(PersistenceMode.InnerDefaultProperty)
]
public IEnumerable<SelectListItem> Value {
get {
if (ViewState ["Value"] == null)
ViewState ["Value"] = new List<SelectListItem> ();
return (IEnumerable<SelectListItem>) ViewState["Value"];
}
set {
ViewState ["Value"] = value;
}
}
/// <summary>
/// Gets or sets the on change.
/// </summary>
/// <value>The on change.</value>
[Bindable (true), DefaultValue(""), Localizable(false)]
public string OnChange {
get {
return (string) ViewState["OnChange"];
}
set {
ViewState ["OnChange"] = value;
}
}
/// <summary>
/// Gets or sets a value indicating whether this <see cref="Yavsc.WebControls.InputUserName"/> is multiple.
/// </summary>
/// <value><c>true</c> if multiple; otherwise, <c>false</c>.</value>
[Bindable (true), DefaultValue(false)]
public bool Multiple {
get {
return (bool) ViewState["Multiple"];
}
set {
ViewState ["Multiple"] = value;
}
}
/// <summary>
/// Gets or sets the empty value.
/// </summary>
/// <value>The empty value.</value>
[Bindable (true), DefaultValue(null)]
public string EmptyValue {
get {
return (string) ViewState["EmptyValue"];
}
set {
ViewState ["EmptyValue"] = value;
}
}
/// <summary>
/// Renders the contents.
/// </summary>
/// <param name="writer">Writer.</param>
protected override void RenderContents (HtmlTextWriter writer)
{
writer.AddAttribute ("id", ID);
writer.AddAttribute ("name", Name);
writer.AddAttribute ("class", CssClass);
if (!string.IsNullOrWhiteSpace(OnChange))
writer.AddAttribute ("onchange", OnChange);
if (Multiple)
writer.AddAttribute ("multiple","true");
writer.RenderBeginTag ("select");
if (EmptyValue!=null) {
writer.AddAttribute ("value", "");
writer.RenderBeginTag ("option");
writer.Write (EmptyValue);
writer.RenderEndTag ();
}
var u = Membership.GetUser ();
if (u != null) {
var circles = CircleManager.DefaultProvider.List (u.UserName);
foreach (SelectListItem sli in Value) {
if (circles.Any( x=> x.Title == sli.Text)) {
writer.AddAttribute ("selected", null);
break;
}
writer.AddAttribute ("value", sli.Value );
writer.RenderBeginTag ("option");
writer.Write (sli.Text);
writer.RenderEndTag ();
}
}
writer.RenderEndTag ();
}
}
}

@ -1,189 +0,0 @@
//
// SelectUserControl.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;
using System.Web;
using System.Security.Permissions;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Web.Security;
namespace Yavsc.WebControls
{
/// <summary>
/// Select user control.
/// </summary>
[
AspNetHostingPermission (SecurityAction.Demand,
Level = AspNetHostingPermissionLevel.Minimal),
AspNetHostingPermission (SecurityAction.InheritanceDemand,
Level = AspNetHostingPermissionLevel.Minimal),
ParseChildren (true),
DefaultProperty ("Name"),
ToolboxData ("<{0}:InputUserName runat=\"server\"> </{0}:InputUserName>")
]
public class InputUserName: WebControl
{
/// <summary>
/// Initializes a new instance of the <see cref="WebControls.InputUserName"/> class.
/// </summary>
public InputUserName ()
{
Multiple = false;
EmptyValue = null;
}
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
[Bindable (true)]
[DefaultValue("")]
[Localizable(true)]
public string Name {
get {
return (string) ViewState["Name"];
}
set {
ViewState ["Name"] = value;
}
}
/// <summary>
/// Gets or sets the value.
/// </summary>
/// <value>The value.</value>
[Bindable (true),DefaultValue(""),Localizable(true)]
public string Value {
get {
return (string) ViewState["Value"];
}
set {
ViewState ["Value"] = value;
}
}
/// <summary>
/// Gets or sets the client side action on change.
/// </summary>
/// <value>The on change.</value>
[Bindable (true),DefaultValue(""),Localizable(false)]
public string OnChange {
get {
return (string) ViewState["OnChange"];
}
set {
ViewState ["OnChange"] = value;
}
}
/// <summary>
/// Gets or sets the in role.
/// </summary>
/// <value>The in role.</value>
[Bindable (true),DefaultValue(""),Localizable(true)]
public string InRole {
get {
return (string) ViewState["InRole"];
}
set {
ViewState ["InRole"] = value;
}
}
/// <summary>
/// Gets or sets a value indicating whether this <see cref="Yavsc.WebControls.InputUserName"/> is multiple.
/// </summary>
/// <value><c>true</c> if multiple; otherwise, <c>false</c>.</value>
[Bindable (true), DefaultValue(false)]
public bool Multiple {
get {
return (bool) ViewState["Multiple"];
}
set {
ViewState ["Multiple"] = value;
}
}
/// <summary>
/// Gets or sets the empty value.
/// </summary>
/// <value>The empty value.</value>
[Bindable (true), DefaultValue(null)]
public string EmptyValue {
get {
return (string) ViewState["EmptyValue"];
}
set {
ViewState ["EmptyValue"] = value;
}
}
/// <summary>
/// Renders the contents.
/// </summary>
/// <param name="writer">Writer.</param>
protected override void RenderContents (HtmlTextWriter writer)
{
writer.AddAttribute ("id", ID);
writer.AddAttribute ("name", Name);
writer.AddAttribute ("class", CssClass);
if (!string.IsNullOrWhiteSpace(OnChange))
writer.AddAttribute ("onchange", OnChange);
if (Multiple)
writer.AddAttribute ("multiple","true");
writer.RenderBeginTag ("select");
string[] selected = null;
string[] roles = null;
if (!string.IsNullOrWhiteSpace (Value)) {
selected = Value.Split (',');
}
if (!string.IsNullOrWhiteSpace (InRole)) {
roles = InRole.Split (',');
}
if (EmptyValue!=null) {
writer.AddAttribute ("value", "");
writer.RenderBeginTag ("option");
writer.Write (EmptyValue);
writer.RenderEndTag ();
}
foreach (MembershipUser u in Membership.GetAllUsers()) {
// if roles are specified, members must be in one of them
if (roles != null)
if (!Array.Exists (roles, x => Roles.IsUserInRole (x)))
continue;
if (selected!=null)
if (Array.Exists(selected, x=> x == u.UserName))
writer.AddAttribute ("selected",null);
writer.RenderBeginTag ("option");
writer.Write (u.UserName);
writer.RenderEndTag ();
}
writer.RenderEndTag ();
}
}
}

@ -1,23 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Web.UI;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("WebControls")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("Paul Schneider")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
[assembly: TagPrefix("Yavsc.WebControls", "yavsc")]

@ -1,90 +0,0 @@
//
// RateControl.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Web.Mvc;
using Yavsc.Model;
namespace Yavsc
{
/// <summary>
/// Rate control.
/// </summary>
public class RateControl<TModel> : ViewUserControl<TModel> where TModel : IRating
{
/// <summary>
/// Initializes a new instance of the Yavsc.Blogs.RateControl class.
/// </summary>
public RateControl ()
{
}
/// <summary>
/// Gets or sets the rate, that is, an integer between 0 and 100
/// </summary>
/// <value>The rate.</value>
public int Rate
{
get { return (int) ViewState["rate"]; }
set {
ViewState["rate"] = value;
int rate = value;
int rounded = (rate / 10);
HasHalf = rounded % 2 == 1;
NbFilled = (int)rounded / 2;
NbEmpty = (5 - NbFilled) - ((HasHalf)?1:0) ;
}
}
/// <summary>
/// Gets the nb filed.
/// </summary>
/// <value>The nb filed.</value>
public int NbFilled {
set { ViewState["nbfilled"] = value; }
get { return (int) ViewState["nbfilled"]; }
}
/// <summary>
/// Gets the nb empty.
/// </summary>
/// <value>The nb empty.</value>
public int NbEmpty {
set { ViewState["nbempty"] = value; }
get { return (int) ViewState["nbempty"]; }
}
/// <summary>
/// Gets a value indicating whether this instance has half.
/// </summary>
/// <value><c>true</c> if this instance has half; otherwise, <c>false</c>.</value>
public bool HasHalf {
set { ViewState["hashalf"] = value; }
get { return (bool) ViewState["hashalf"]; }
}
protected override void OnInit (EventArgs e)
{
base.OnInit (e);
Rate = this.Model.Rate;
}
}
}

@ -1,196 +0,0 @@
using System;
using System.Web;
using System.Security.Permissions;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Collections;
namespace Yavsc.WebControls
{
/// <summary>
/// Result pages.
/// </summary>
[
AspNetHostingPermission (SecurityAction.Demand,
Level = AspNetHostingPermissionLevel.Minimal),
AspNetHostingPermission (SecurityAction.InheritanceDemand,
Level = AspNetHostingPermissionLevel.Minimal),
ParseChildren (true),
ToolboxData ("<{0}:ResultPages runat=\"server\"> </{0}:ResultPages>")
]
public class ResultPages: WebControl
{
/// <summary>
/// Initializes a new instance of the <see cref="Yavsc.WebControls.ResultPages"/> class.
/// </summary>
public ResultPages ()
{
}
/// <summary>
/// Gets or sets the results per page.
/// </summary>
/// <value>The results per page.</value>
public int PageSize {
get {
return (int)( ViewState["PageSize"]==null?10:ViewState["PageSize"]);
}
set {
ViewState["PageSize"]=value;
}
}
/// <summary>
/// Gets or sets the result count.
/// </summary>
/// <value>The result count.</value>
public int ResultCount {
get {
return (int)( ViewState["ResultCount"]==null?0:ViewState["ResultCount"]);
}
set {
ViewState["ResultCount"] = value;
}
}
/// <summary>
/// Gets or sets the text.
/// </summary>
/// <value>The text.</value>
[DefaultValue("Pages:")]
[Localizable(true)]
public string Text {
get {
string s = (string)ViewState["Text"];
return (s == null) ? "Pages:" : s;
}
set {
ViewState["Text"] = value;
}
}
/// <summary>
/// Gets or sets the action.
/// </summary>
/// <value>The action.</value>
[Bindable (true)]
[DefaultValue("?pageIndex=")]
public string Action {
get {
string s = (string)ViewState["Action"];
return (s == null) ? "?pageIndex=" : s;
}
set {
ViewState["Action"] = value;
}
}
/// <summary>
/// Gets or sets the Single page message.
/// </summary>
/// <value>The none.</value>
[Bindable (true)]
[DefaultValue("1")]
public string SinglePage {
get {
return (string) ViewState["SinglePage"];
}
set {
ViewState["SinglePage"] = value;
}
}
/// <summary>
/// Gets or sets the none.
/// </summary>
/// <value>The none.</value>
[Bindable (true)]
[DefaultValue("none")]
public string None {
get {
return (string) ViewState["None"];
}
set {
ViewState["None"] = value;
}
}
/// <summary>
/// Gets or sets the none.
/// </summary>
/// <value>The none.</value>
[Bindable (true)]
[DefaultValue("Pages: ")]
public string PagesLabel {
get {
return (string) ViewState["PagesLabel"];
}
set {
ViewState["PagesLabel"] = value;
}
}
/// <summary>
/// Gets or sets the current page.
/// </summary>
/// <value>The current page.</value>
[Bindable (true)]
[DefaultValue(0)]
public int PageIndex {
get {
int i = (int)(ViewState["PageIndex"]==null?0:ViewState["PageIndex"]);
return i;
}
set {
ViewState["PageIndex"] = value;
}
}
/// <summary>
/// Renders the contents as the list of links to pages of results.
/// </summary>
/// <param name="writer">Writer.</param>
protected override void RenderContents (HtmlTextWriter writer)
{
// avoids a division by zero
if (PageSize <= 0)
PageSize = 5;
if (ResultCount > 0 && ResultCount > PageSize ) {
writer.WriteEncodedText (Text);
int pageCount = ((ResultCount-1) / PageSize) + 1;
if ( pageCount > 1 ) {
if (!string.IsNullOrWhiteSpace(CssClass))
writer.AddAttribute ("class", this.CssClass);
writer.RenderBeginTag ("div");
writer.Write (PagesLabel);
for (int pi = (PageIndex < 5) ? 0 : PageIndex - 5; pi < pageCount && pi < PageIndex + 5; pi++) {
if (PageIndex == pi)
writer.RenderBeginTag ("b");
else {
writer.AddAttribute (HtmlTextWriterAttribute.Href,
string.Format (Action, pi));
writer.RenderBeginTag ("a");
}
writer.Write (pi + 1);
writer.RenderEndTag ();
writer.Write ("&nbsp;");
}
RenderChildren (writer);
writer.RenderEndTag ();
}
else {
writer.Write (SinglePage);
}
}
if (ResultCount == 0) {
writer.Write (None);
}
}
}
}

@ -1,81 +0,0 @@
//
// UserCard.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Web.UI.WebControls;
using System.Web;
using System.Security.Permissions;
using System.Web.UI;
using System.ComponentModel;
using System.Web.Security;
namespace Yavsc.WebControls
{
/// <summary>
/// User card.
/// </summary>
[
AspNetHostingPermission (SecurityAction.Demand,
Level = AspNetHostingPermissionLevel.Minimal),
AspNetHostingPermission (SecurityAction.InheritanceDemand,
Level = AspNetHostingPermissionLevel.Minimal),
ParseChildren (true),
DefaultProperty ("Name"),
ToolboxData ("<{0}:UserCard runat=\"server\"> </{0}:UserCard>")
]
public class UserCard: WebControl
{
/// <summary>
/// Initializes a new instance of the <see cref="WebControls.UserCard"/> class.
/// </summary>
public UserCard ()
{
}
[Bindable (true), DefaultValue(""), Localizable(false)]
string UserName { get; set; }
[Bindable (true), DefaultValue("(<a href=\"/Account/Profile\">You</a>)"), Localizable(true)]
string yourTag { get; set; }
/// <summary>
/// Renders the contents.
/// </summary>
/// <param name="writer">Writer.</param>
protected override void RenderContents (HtmlTextWriter writer)
{
if (UserName != null) {
// icon, stats
writer.AddAttribute ("id", ID);
writer.AddAttribute ("class", CssClass);
writer.RenderBeginTag ("div");
writer.Write (UserName+" ");
var vuser = Membership.GetUser();
if (vuser != null)
if (vuser.UserName == UserName)
writer.Write (yourTag);
writer.RenderEndTag ();
}
}
}
}

@ -1,112 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{59E1DF7B-FFA0-4DEB-B5F3-76EBD98D5356}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>WebControls</RootNamespace>
<AssemblyName>Yavsc.WebControls</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<DocumentationFile>bin\Debug\Yavsc.WebControls.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Lua|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Lua</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'TotemPre|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\TotemPre</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'TotemProd|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\TotemProd</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'YavscPre|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\YavscPre</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Yavsc|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Yavsc</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'LuaDebug|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Lua</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Abstractions" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Configuration" />
<Reference Include="Microsoft.Web.Infrastructure">
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor">
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.Helpers">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Deployment">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Razor">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.Mvc">
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ResultPages.cs" />
<Compile Include="InputUserName.cs" />
<Compile Include="InputCircle.cs" />
<Compile Include="UserCard.cs" />
<Compile Include="RateControl.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\yavscModel\YavscModel.csproj">
<Project>{68F5B80A-616E-4C3C-91A0-828AA40000BD}</Project>
<Name>YavscModel</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net451" />
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net451" />
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net451" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net451" />
</packages>

@ -1,256 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yavsc", "web\Yavsc.csproj", "{77044C92-D2F1-45BD-80DD-AA25B311B027}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NpgsqlMRPProviders", "NpgsqlMRPProviders\NpgsqlMRPProviders.csproj", "{BBA7175D-7F92-4278-96FC-84C495A2B5A6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NpgsqlBlogProvider", "NpgsqlBlogProvider\NpgsqlBlogProvider.csproj", "{C6E9E91B-97D3-48D9-8AA7-05356929E162}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SalesCatalog", "SalesCatalog\SalesCatalog.csproj", "{90BF2234-7252-4CD5-B2A4-17501B19279B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YavscModel", "yavscModel\YavscModel.csproj", "{68F5B80A-616E-4C3C-91A0-828AA40000BD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NpgsqlContentProvider", "NpgsqlContentProvider\NpgsqlContentProvider.csproj", "{821FF72D-9F4B-4A2C-B95C-7B965291F119}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YavscClient", "yavscclient\YavscClient.csproj", "{EEFCECE6-3B7F-4BBE-B7AF-69377AF3CF39}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebControls", "WebControls\WebControls.csproj", "{59E1DF7B-FFA0-4DEB-B5F3-76EBD98D5356}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ITContentProvider", "ITContentProvider\ITContentProvider.csproj", "{9D7D892E-9B77-4713-892D-C26E1E944119}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "plugins", "plugins", "{ECEC9074-ACB5-4A74-BE22-FF7B40F25A1A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "fortune", "plugins\fortune\fortune.csproj", "{B5F49C21-7BB3-4DC0-AE65-F4ED0F6D15BD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7E3CF14D-91B6-4088-8630-7655C749130E}"
ProjectSection(SolutionItems) = preProject
LICENSE = LICENSE
Makefile = Makefile
README.md = README.md
Features.md = Features.md
EndProjectSection
EndProject
Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "pkg", "pkg\pkg.mdproj", "{C6DBD1DC-B619-4DC7-BC92-15693508541E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestAPI", "TestAPI\TestAPI.csproj", "{42B77C89-BF6D-4DB1-8763-6197F4030A95}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Presta", "Presta\Presta.csproj", "{6A312228-9641-478D-916F-4681CC65A35D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Lua|Any CPU = Lua|Any CPU
TotemPre|Any CPU = TotemPre|Any CPU
TotemProd|Any CPU = TotemProd|Any CPU
YavscPre|Any CPU = YavscPre|Any CPU
Yavsc|Any CPU = Yavsc|Any CPU
LuaDebug|Any CPU = LuaDebug|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{42B77C89-BF6D-4DB1-8763-6197F4030A95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{42B77C89-BF6D-4DB1-8763-6197F4030A95}.Debug|Any CPU.Build.0 = Debug|Any CPU
{42B77C89-BF6D-4DB1-8763-6197F4030A95}.Lua|Any CPU.ActiveCfg = Lua|Any CPU
{42B77C89-BF6D-4DB1-8763-6197F4030A95}.LuaDebug|Any CPU.ActiveCfg = Debug|Any CPU
{42B77C89-BF6D-4DB1-8763-6197F4030A95}.Release|Any CPU.ActiveCfg = Release|Any CPU
{42B77C89-BF6D-4DB1-8763-6197F4030A95}.Release|Any CPU.Build.0 = Release|Any CPU
{42B77C89-BF6D-4DB1-8763-6197F4030A95}.TotemPre|Any CPU.ActiveCfg = TotemPre|Any CPU
{42B77C89-BF6D-4DB1-8763-6197F4030A95}.TotemProd|Any CPU.ActiveCfg = TotemProd|Any CPU
{42B77C89-BF6D-4DB1-8763-6197F4030A95}.TotemProd|Any CPU.Build.0 = TotemProd|Any CPU
{42B77C89-BF6D-4DB1-8763-6197F4030A95}.Yavsc|Any CPU.ActiveCfg = Yavsc|Any CPU
{42B77C89-BF6D-4DB1-8763-6197F4030A95}.YavscPre|Any CPU.ActiveCfg = YavscPre|Any CPU
{59E1DF7B-FFA0-4DEB-B5F3-76EBD98D5356}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{59E1DF7B-FFA0-4DEB-B5F3-76EBD98D5356}.Debug|Any CPU.Build.0 = Debug|Any CPU
{59E1DF7B-FFA0-4DEB-B5F3-76EBD98D5356}.Lua|Any CPU.ActiveCfg = Lua|Any CPU
{59E1DF7B-FFA0-4DEB-B5F3-76EBD98D5356}.Lua|Any CPU.Build.0 = Lua|Any CPU
{59E1DF7B-FFA0-4DEB-B5F3-76EBD98D5356}.LuaDebug|Any CPU.ActiveCfg = Debug|Any CPU
{59E1DF7B-FFA0-4DEB-B5F3-76EBD98D5356}.LuaDebug|Any CPU.Build.0 = Debug|Any CPU
{59E1DF7B-FFA0-4DEB-B5F3-76EBD98D5356}.Release|Any CPU.ActiveCfg = Release|Any CPU
{59E1DF7B-FFA0-4DEB-B5F3-76EBD98D5356}.Release|Any CPU.Build.0 = Release|Any CPU
{59E1DF7B-FFA0-4DEB-B5F3-76EBD98D5356}.TotemPre|Any CPU.ActiveCfg = TotemPre|Any CPU
{59E1DF7B-FFA0-4DEB-B5F3-76EBD98D5356}.TotemPre|Any CPU.Build.0 = TotemPre|Any CPU
{59E1DF7B-FFA0-4DEB-B5F3-76EBD98D5356}.TotemProd|Any CPU.ActiveCfg = TotemProd|Any CPU
{59E1DF7B-FFA0-4DEB-B5F3-76EBD98D5356}.TotemProd|Any CPU.Build.0 = TotemProd|Any CPU
{59E1DF7B-FFA0-4DEB-B5F3-76EBD98D5356}.Yavsc|Any CPU.ActiveCfg = Yavsc|Any CPU
{59E1DF7B-FFA0-4DEB-B5F3-76EBD98D5356}.Yavsc|Any CPU.Build.0 = Yavsc|Any CPU
{59E1DF7B-FFA0-4DEB-B5F3-76EBD98D5356}.YavscPre|Any CPU.ActiveCfg = YavscPre|Any CPU
{59E1DF7B-FFA0-4DEB-B5F3-76EBD98D5356}.YavscPre|Any CPU.Build.0 = YavscPre|Any CPU
{68F5B80A-616E-4C3C-91A0-828AA40000BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{68F5B80A-616E-4C3C-91A0-828AA40000BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{68F5B80A-616E-4C3C-91A0-828AA40000BD}.Lua|Any CPU.ActiveCfg = Lua|Any CPU
{68F5B80A-616E-4C3C-91A0-828AA40000BD}.Lua|Any CPU.Build.0 = Lua|Any CPU
{68F5B80A-616E-4C3C-91A0-828AA40000BD}.LuaDebug|Any CPU.ActiveCfg = Debug|Any CPU
{68F5B80A-616E-4C3C-91A0-828AA40000BD}.LuaDebug|Any CPU.Build.0 = Debug|Any CPU
{68F5B80A-616E-4C3C-91A0-828AA40000BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{68F5B80A-616E-4C3C-91A0-828AA40000BD}.Release|Any CPU.Build.0 = Release|Any CPU
{68F5B80A-616E-4C3C-91A0-828AA40000BD}.TotemPre|Any CPU.ActiveCfg = TotemPre|Any CPU
{68F5B80A-616E-4C3C-91A0-828AA40000BD}.TotemPre|Any CPU.Build.0 = TotemPre|Any CPU
{68F5B80A-616E-4C3C-91A0-828AA40000BD}.TotemProd|Any CPU.ActiveCfg = TotemProd|Any CPU
{68F5B80A-616E-4C3C-91A0-828AA40000BD}.TotemProd|Any CPU.Build.0 = TotemProd|Any CPU
{68F5B80A-616E-4C3C-91A0-828AA40000BD}.Yavsc|Any CPU.ActiveCfg = Yavsc|Any CPU
{68F5B80A-616E-4C3C-91A0-828AA40000BD}.Yavsc|Any CPU.Build.0 = Yavsc|Any CPU
{68F5B80A-616E-4C3C-91A0-828AA40000BD}.YavscPre|Any CPU.ActiveCfg = YavscPre|Any CPU
{68F5B80A-616E-4C3C-91A0-828AA40000BD}.YavscPre|Any CPU.Build.0 = YavscPre|Any CPU
{6A312228-9641-478D-916F-4681CC65A35D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6A312228-9641-478D-916F-4681CC65A35D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6A312228-9641-478D-916F-4681CC65A35D}.Lua|Any CPU.ActiveCfg = Lua|Any CPU
{6A312228-9641-478D-916F-4681CC65A35D}.Lua|Any CPU.Build.0 = Lua|Any CPU
{6A312228-9641-478D-916F-4681CC65A35D}.LuaDebug|Any CPU.ActiveCfg = Debug|Any CPU
{6A312228-9641-478D-916F-4681CC65A35D}.LuaDebug|Any CPU.Build.0 = Debug|Any CPU
{6A312228-9641-478D-916F-4681CC65A35D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6A312228-9641-478D-916F-4681CC65A35D}.Release|Any CPU.Build.0 = Release|Any CPU
{6A312228-9641-478D-916F-4681CC65A35D}.TotemPre|Any CPU.ActiveCfg = TotemPre|Any CPU
{6A312228-9641-478D-916F-4681CC65A35D}.TotemProd|Any CPU.ActiveCfg = TotemProd|Any CPU
{6A312228-9641-478D-916F-4681CC65A35D}.TotemProd|Any CPU.Build.0 = TotemProd|Any CPU
{6A312228-9641-478D-916F-4681CC65A35D}.Yavsc|Any CPU.ActiveCfg = Yavsc|Any CPU
{6A312228-9641-478D-916F-4681CC65A35D}.Yavsc|Any CPU.Build.0 = Yavsc|Any CPU
{6A312228-9641-478D-916F-4681CC65A35D}.YavscPre|Any CPU.ActiveCfg = YavscPre|Any CPU
{77044C92-D2F1-45BD-80DD-AA25B311B027}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{77044C92-D2F1-45BD-80DD-AA25B311B027}.Debug|Any CPU.Build.0 = Debug|Any CPU
{77044C92-D2F1-45BD-80DD-AA25B311B027}.Lua|Any CPU.ActiveCfg = Lua|Any CPU
{77044C92-D2F1-45BD-80DD-AA25B311B027}.Lua|Any CPU.Build.0 = Lua|Any CPU
{77044C92-D2F1-45BD-80DD-AA25B311B027}.LuaDebug|Any CPU.ActiveCfg = LuaDebug|Any CPU
{77044C92-D2F1-45BD-80DD-AA25B311B027}.LuaDebug|Any CPU.Build.0 = LuaDebug|Any CPU
{77044C92-D2F1-45BD-80DD-AA25B311B027}.Release|Any CPU.ActiveCfg = Release|Any CPU
{77044C92-D2F1-45BD-80DD-AA25B311B027}.Release|Any CPU.Build.0 = Release|Any CPU
{77044C92-D2F1-45BD-80DD-AA25B311B027}.TotemPre|Any CPU.ActiveCfg = TotemPre|Any CPU
{77044C92-D2F1-45BD-80DD-AA25B311B027}.TotemPre|Any CPU.Build.0 = TotemPre|Any CPU
{77044C92-D2F1-45BD-80DD-AA25B311B027}.TotemProd|Any CPU.ActiveCfg = TotemProd|Any CPU
{77044C92-D2F1-45BD-80DD-AA25B311B027}.TotemProd|Any CPU.Build.0 = TotemProd|Any CPU
{77044C92-D2F1-45BD-80DD-AA25B311B027}.Yavsc|Any CPU.ActiveCfg = Yavsc|Any CPU
{77044C92-D2F1-45BD-80DD-AA25B311B027}.Yavsc|Any CPU.Build.0 = Yavsc|Any CPU
{77044C92-D2F1-45BD-80DD-AA25B311B027}.YavscPre|Any CPU.ActiveCfg = YavscPre|Any CPU
{77044C92-D2F1-45BD-80DD-AA25B311B027}.YavscPre|Any CPU.Build.0 = YavscPre|Any CPU
{821FF72D-9F4B-4A2C-B95C-7B965291F119}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{821FF72D-9F4B-4A2C-B95C-7B965291F119}.Debug|Any CPU.Build.0 = Debug|Any CPU
{821FF72D-9F4B-4A2C-B95C-7B965291F119}.Lua|Any CPU.ActiveCfg = Lua|Any CPU
{821FF72D-9F4B-4A2C-B95C-7B965291F119}.Lua|Any CPU.Build.0 = Lua|Any CPU
{821FF72D-9F4B-4A2C-B95C-7B965291F119}.LuaDebug|Any CPU.ActiveCfg = Debug|Any CPU
{821FF72D-9F4B-4A2C-B95C-7B965291F119}.LuaDebug|Any CPU.Build.0 = Debug|Any CPU
{821FF72D-9F4B-4A2C-B95C-7B965291F119}.Release|Any CPU.ActiveCfg = Release|Any CPU
{821FF72D-9F4B-4A2C-B95C-7B965291F119}.Release|Any CPU.Build.0 = Release|Any CPU
{821FF72D-9F4B-4A2C-B95C-7B965291F119}.TotemPre|Any CPU.ActiveCfg = TotemPre|Any CPU
{821FF72D-9F4B-4A2C-B95C-7B965291F119}.TotemPre|Any CPU.Build.0 = TotemPre|Any CPU
{821FF72D-9F4B-4A2C-B95C-7B965291F119}.TotemProd|Any CPU.ActiveCfg = TotemProd|Any CPU
{821FF72D-9F4B-4A2C-B95C-7B965291F119}.TotemProd|Any CPU.Build.0 = TotemProd|Any CPU
{821FF72D-9F4B-4A2C-B95C-7B965291F119}.Yavsc|Any CPU.ActiveCfg = Yavsc|Any CPU
{821FF72D-9F4B-4A2C-B95C-7B965291F119}.Yavsc|Any CPU.Build.0 = Yavsc|Any CPU
{821FF72D-9F4B-4A2C-B95C-7B965291F119}.YavscPre|Any CPU.ActiveCfg = YavscPre|Any CPU
{821FF72D-9F4B-4A2C-B95C-7B965291F119}.YavscPre|Any CPU.Build.0 = YavscPre|Any CPU
{90BF2234-7252-4CD5-B2A4-17501B19279B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{90BF2234-7252-4CD5-B2A4-17501B19279B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{90BF2234-7252-4CD5-B2A4-17501B19279B}.Lua|Any CPU.ActiveCfg = Lua|Any CPU
{90BF2234-7252-4CD5-B2A4-17501B19279B}.Lua|Any CPU.Build.0 = Lua|Any CPU
{90BF2234-7252-4CD5-B2A4-17501B19279B}.LuaDebug|Any CPU.ActiveCfg = Debug|Any CPU
{90BF2234-7252-4CD5-B2A4-17501B19279B}.LuaDebug|Any CPU.Build.0 = Debug|Any CPU
{90BF2234-7252-4CD5-B2A4-17501B19279B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{90BF2234-7252-4CD5-B2A4-17501B19279B}.Release|Any CPU.Build.0 = Release|Any CPU
{90BF2234-7252-4CD5-B2A4-17501B19279B}.TotemPre|Any CPU.ActiveCfg = TotemPre|Any CPU
{90BF2234-7252-4CD5-B2A4-17501B19279B}.TotemProd|Any CPU.ActiveCfg = TotemProd|Any CPU
{90BF2234-7252-4CD5-B2A4-17501B19279B}.TotemProd|Any CPU.Build.0 = TotemProd|Any CPU
{90BF2234-7252-4CD5-B2A4-17501B19279B}.Yavsc|Any CPU.ActiveCfg = Yavsc|Any CPU
{90BF2234-7252-4CD5-B2A4-17501B19279B}.Yavsc|Any CPU.Build.0 = Yavsc|Any CPU
{90BF2234-7252-4CD5-B2A4-17501B19279B}.YavscPre|Any CPU.ActiveCfg = YavscPre|Any CPU
{90BF2234-7252-4CD5-B2A4-17501B19279B}.YavscPre|Any CPU.Build.0 = YavscPre|Any CPU
{9D7D892E-9B77-4713-892D-C26E1E944119}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9D7D892E-9B77-4713-892D-C26E1E944119}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9D7D892E-9B77-4713-892D-C26E1E944119}.Lua|Any CPU.ActiveCfg = Lua|Any CPU
{9D7D892E-9B77-4713-892D-C26E1E944119}.Lua|Any CPU.Build.0 = Lua|Any CPU
{9D7D892E-9B77-4713-892D-C26E1E944119}.LuaDebug|Any CPU.ActiveCfg = Debug|Any CPU
{9D7D892E-9B77-4713-892D-C26E1E944119}.LuaDebug|Any CPU.Build.0 = Debug|Any CPU
{9D7D892E-9B77-4713-892D-C26E1E944119}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9D7D892E-9B77-4713-892D-C26E1E944119}.Release|Any CPU.Build.0 = Release|Any CPU
{9D7D892E-9B77-4713-892D-C26E1E944119}.TotemPre|Any CPU.ActiveCfg = TotemPre|Any CPU
{9D7D892E-9B77-4713-892D-C26E1E944119}.TotemPre|Any CPU.Build.0 = TotemPre|Any CPU
{9D7D892E-9B77-4713-892D-C26E1E944119}.TotemProd|Any CPU.ActiveCfg = TotemProd|Any CPU
{9D7D892E-9B77-4713-892D-C26E1E944119}.TotemProd|Any CPU.Build.0 = TotemProd|Any CPU
{9D7D892E-9B77-4713-892D-C26E1E944119}.Yavsc|Any CPU.ActiveCfg = Yavsc|Any CPU
{9D7D892E-9B77-4713-892D-C26E1E944119}.Yavsc|Any CPU.Build.0 = Yavsc|Any CPU
{9D7D892E-9B77-4713-892D-C26E1E944119}.YavscPre|Any CPU.ActiveCfg = YavscPre|Any CPU
{9D7D892E-9B77-4713-892D-C26E1E944119}.YavscPre|Any CPU.Build.0 = YavscPre|Any CPU
{B5F49C21-7BB3-4DC0-AE65-F4ED0F6D15BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B5F49C21-7BB3-4DC0-AE65-F4ED0F6D15BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B5F49C21-7BB3-4DC0-AE65-F4ED0F6D15BD}.Lua|Any CPU.ActiveCfg = Lua|Any CPU
{B5F49C21-7BB3-4DC0-AE65-F4ED0F6D15BD}.LuaDebug|Any CPU.ActiveCfg = Debug|Any CPU
{B5F49C21-7BB3-4DC0-AE65-F4ED0F6D15BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B5F49C21-7BB3-4DC0-AE65-F4ED0F6D15BD}.Release|Any CPU.Build.0 = Release|Any CPU
{B5F49C21-7BB3-4DC0-AE65-F4ED0F6D15BD}.TotemPre|Any CPU.ActiveCfg = TotemPre|Any CPU
{B5F49C21-7BB3-4DC0-AE65-F4ED0F6D15BD}.TotemProd|Any CPU.ActiveCfg = TotemProd|Any CPU
{B5F49C21-7BB3-4DC0-AE65-F4ED0F6D15BD}.Yavsc|Any CPU.ActiveCfg = Yavsc|Any CPU
{B5F49C21-7BB3-4DC0-AE65-F4ED0F6D15BD}.Yavsc|Any CPU.Build.0 = Yavsc|Any CPU
{B5F49C21-7BB3-4DC0-AE65-F4ED0F6D15BD}.YavscPre|Any CPU.ActiveCfg = YavscPre|Any CPU
{BBA7175D-7F92-4278-96FC-84C495A2B5A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BBA7175D-7F92-4278-96FC-84C495A2B5A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BBA7175D-7F92-4278-96FC-84C495A2B5A6}.Lua|Any CPU.ActiveCfg = Lua|Any CPU
{BBA7175D-7F92-4278-96FC-84C495A2B5A6}.Lua|Any CPU.Build.0 = Lua|Any CPU
{BBA7175D-7F92-4278-96FC-84C495A2B5A6}.LuaDebug|Any CPU.ActiveCfg = Debug|Any CPU
{BBA7175D-7F92-4278-96FC-84C495A2B5A6}.LuaDebug|Any CPU.Build.0 = Debug|Any CPU
{BBA7175D-7F92-4278-96FC-84C495A2B5A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BBA7175D-7F92-4278-96FC-84C495A2B5A6}.Release|Any CPU.Build.0 = Release|Any CPU
{BBA7175D-7F92-4278-96FC-84C495A2B5A6}.TotemPre|Any CPU.ActiveCfg = TotemPre|Any CPU
{BBA7175D-7F92-4278-96FC-84C495A2B5A6}.TotemPre|Any CPU.Build.0 = TotemPre|Any CPU
{BBA7175D-7F92-4278-96FC-84C495A2B5A6}.TotemProd|Any CPU.ActiveCfg = TotemProd|Any CPU
{BBA7175D-7F92-4278-96FC-84C495A2B5A6}.TotemProd|Any CPU.Build.0 = TotemProd|Any CPU
{BBA7175D-7F92-4278-96FC-84C495A2B5A6}.Yavsc|Any CPU.ActiveCfg = Yavsc|Any CPU
{BBA7175D-7F92-4278-96FC-84C495A2B5A6}.Yavsc|Any CPU.Build.0 = Yavsc|Any CPU
{BBA7175D-7F92-4278-96FC-84C495A2B5A6}.YavscPre|Any CPU.ActiveCfg = YavscPre|Any CPU
{BBA7175D-7F92-4278-96FC-84C495A2B5A6}.YavscPre|Any CPU.Build.0 = YavscPre|Any CPU
{C6DBD1DC-B619-4DC7-BC92-15693508541E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C6DBD1DC-B619-4DC7-BC92-15693508541E}.Lua|Any CPU.ActiveCfg = Lua|Any CPU
{C6DBD1DC-B619-4DC7-BC92-15693508541E}.LuaDebug|Any CPU.ActiveCfg = LuaDebug|Any CPU
{C6DBD1DC-B619-4DC7-BC92-15693508541E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C6DBD1DC-B619-4DC7-BC92-15693508541E}.TotemPre|Any CPU.ActiveCfg = TotemPre|Any CPU
{C6DBD1DC-B619-4DC7-BC92-15693508541E}.TotemProd|Any CPU.ActiveCfg = TotemProd|Any CPU
{C6DBD1DC-B619-4DC7-BC92-15693508541E}.Yavsc|Any CPU.ActiveCfg = Yavsc|Any CPU
{C6DBD1DC-B619-4DC7-BC92-15693508541E}.YavscPre|Any CPU.ActiveCfg = YavscPre|Any CPU
{C6E9E91B-97D3-48D9-8AA7-05356929E162}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C6E9E91B-97D3-48D9-8AA7-05356929E162}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C6E9E91B-97D3-48D9-8AA7-05356929E162}.Lua|Any CPU.ActiveCfg = Lua|Any CPU
{C6E9E91B-97D3-48D9-8AA7-05356929E162}.Lua|Any CPU.Build.0 = Lua|Any CPU
{C6E9E91B-97D3-48D9-8AA7-05356929E162}.LuaDebug|Any CPU.ActiveCfg = Debug|Any CPU
{C6E9E91B-97D3-48D9-8AA7-05356929E162}.LuaDebug|Any CPU.Build.0 = Debug|Any CPU
{C6E9E91B-97D3-48D9-8AA7-05356929E162}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C6E9E91B-97D3-48D9-8AA7-05356929E162}.Release|Any CPU.Build.0 = Release|Any CPU
{C6E9E91B-97D3-48D9-8AA7-05356929E162}.TotemPre|Any CPU.ActiveCfg = TotemPre|Any CPU
{C6E9E91B-97D3-48D9-8AA7-05356929E162}.TotemPre|Any CPU.Build.0 = TotemPre|Any CPU
{C6E9E91B-97D3-48D9-8AA7-05356929E162}.TotemProd|Any CPU.ActiveCfg = TotemProd|Any CPU
{C6E9E91B-97D3-48D9-8AA7-05356929E162}.TotemProd|Any CPU.Build.0 = TotemProd|Any CPU
{C6E9E91B-97D3-48D9-8AA7-05356929E162}.Yavsc|Any CPU.ActiveCfg = Yavsc|Any CPU
{C6E9E91B-97D3-48D9-8AA7-05356929E162}.Yavsc|Any CPU.Build.0 = Yavsc|Any CPU
{C6E9E91B-97D3-48D9-8AA7-05356929E162}.YavscPre|Any CPU.ActiveCfg = YavscPre|Any CPU
{C6E9E91B-97D3-48D9-8AA7-05356929E162}.YavscPre|Any CPU.Build.0 = YavscPre|Any CPU
{EEFCECE6-3B7F-4BBE-B7AF-69377AF3CF39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EEFCECE6-3B7F-4BBE-B7AF-69377AF3CF39}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EEFCECE6-3B7F-4BBE-B7AF-69377AF3CF39}.Lua|Any CPU.ActiveCfg = Lua|Any CPU
{EEFCECE6-3B7F-4BBE-B7AF-69377AF3CF39}.Lua|Any CPU.Build.0 = Lua|Any CPU
{EEFCECE6-3B7F-4BBE-B7AF-69377AF3CF39}.LuaDebug|Any CPU.ActiveCfg = Debug|Any CPU
{EEFCECE6-3B7F-4BBE-B7AF-69377AF3CF39}.LuaDebug|Any CPU.Build.0 = Debug|Any CPU
{EEFCECE6-3B7F-4BBE-B7AF-69377AF3CF39}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EEFCECE6-3B7F-4BBE-B7AF-69377AF3CF39}.Release|Any CPU.Build.0 = Release|Any CPU
{EEFCECE6-3B7F-4BBE-B7AF-69377AF3CF39}.TotemPre|Any CPU.ActiveCfg = TotemPre|Any CPU
{EEFCECE6-3B7F-4BBE-B7AF-69377AF3CF39}.TotemProd|Any CPU.ActiveCfg = TotemProd|Any CPU
{EEFCECE6-3B7F-4BBE-B7AF-69377AF3CF39}.TotemProd|Any CPU.Build.0 = TotemProd|Any CPU
{EEFCECE6-3B7F-4BBE-B7AF-69377AF3CF39}.Yavsc|Any CPU.ActiveCfg = Yavsc|Any CPU
{EEFCECE6-3B7F-4BBE-B7AF-69377AF3CF39}.Yavsc|Any CPU.Build.0 = Yavsc|Any CPU
{EEFCECE6-3B7F-4BBE-B7AF-69377AF3CF39}.YavscPre|Any CPU.ActiveCfg = YavscPre|Any CPU
{EEFCECE6-3B7F-4BBE-B7AF-69377AF3CF39}.YavscPre|Any CPU.Build.0 = YavscPre|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{B5F49C21-7BB3-4DC0-AE65-F4ED0F6D15BD} = {ECEC9074-ACB5-4A74-BE22-FF7B40F25A1A}
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0
$0.StandardHeader = $1
$1.Text = @\n ${FileName}\n \n Author:\n ${AuthorName} <${AuthorEmail}>\n \n Copyright (c) ${Year} ${CopyrightHolder}\n\n This program is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with this program. If not, see <http://www.gnu.org/licenses/>.
$1.IncludeInNewFiles = True
$0.VersionControlPolicy = $2
$2.inheritsSet = Mono
$0.ChangeLogPolicy = $3
$3.UpdateMode = ProjectRoot
$3.VcsIntegration = RequireEntry
$3.MessageStyle = $4
$4.LineAlign = 0
$3.inheritsSet = Mono
EndGlobalSection
EndGlobal

@ -0,0 +1,11 @@
FROM microsoft/aspnet:1.0.0-rc1-update1
RUN printf "deb http://ftp.us.debian.org/debian jessie main\n" >> /etc/apt/sources.list
RUN apt-get -qq update && apt-get install -qqy sqlite3 libsqlite3-dev && rm -rf /var/lib/apt/lists/*
COPY . /app
WORKDIR /app
RUN ["dnu", "restore"]
EXPOSE 5001/tcp
ENTRYPOINT ["dnx", "-p", "project.json", "web"]

@ -5,7 +5,7 @@ GNU GENERAL PUBLIC LICENSE
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
# Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
@ -70,7 +70,7 @@ modification follow.
TERMS AND CONDITIONS
0. Definitions.
## 0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
@ -109,7 +109,7 @@ work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
## 1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
@ -151,7 +151,7 @@ Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
## 2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
@ -176,7 +176,7 @@ your copyrighted material outside their relationship with you.
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
## 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
@ -192,7 +192,7 @@ modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
## 4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
@ -205,7 +205,7 @@ recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
## 5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
@ -215,8 +215,8 @@ terms of section 4, provided that you also meet all of these conditions:
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
released under this License and any conditions added under section 7.
This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
@ -242,7 +242,7 @@ beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
## 6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
@ -340,7 +340,7 @@ documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
## 7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
@ -404,7 +404,7 @@ where to find the applicable terms.
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
## 8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
@ -432,7 +432,7 @@ this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
## 9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
@ -443,7 +443,7 @@ modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
## 10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
@ -468,7 +468,7 @@ rights granted under this License, and you may not initiate litigation
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
## 11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
@ -537,7 +537,7 @@ or that patent license was granted, prior to 28 March 2007.
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
## 12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
@ -549,7 +549,7 @@ to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
## 13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
@ -560,7 +560,7 @@ but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
## 14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
@ -586,7 +586,7 @@ permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
## 15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
@ -597,7 +597,7 @@ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
## 16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
@ -609,7 +609,7 @@ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
## 17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
@ -620,55 +620,3 @@ copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}
This program 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 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
{project} Copyright (C) {year} {fullname}
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

@ -0,0 +1,444 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models;
namespace Yavsc.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20160315144017_init")]
partial class init
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "7.0.0-rc1-16348");
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasAnnotation("Relational:Name", "RoleNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasAnnotation("Relational:TableName", "AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
});
modelBuilder.Entity("YavscWeb.Location", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address")
.IsRequired();
b.Property<double>("Latitude");
b.Property<double>("Longitude");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.Property<string>("UserId");
b.Property<long>("Credits");
b.Property<long>("HistoryId");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.AccountHistory", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Activity", b =>
{
b.Property<string>("Code")
.HasAnnotation("MaxLength", 512);
b.Property<string>("Description");
b.Property<string>("Name")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<string>("Photo");
b.HasKey("Code");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasAnnotation("Relational:Name", "EmailIndex");
b.HasIndex("NormalizedUserName")
.HasAnnotation("Relational:Name", "UserNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetUsers");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AuthorId")
.IsRequired();
b.Property<string>("bcontent");
b.Property<DateTime>("modified");
b.Property<string>("photo");
b.Property<DateTime>("posted");
b.Property<int>("rate");
b.Property<string>("title");
b.Property<bool>("visible");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Booking.SimpleBookQuery", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("EventDate");
b.Property<long?>("LocationId")
.IsRequired();
b.Property<string>("PerformerId")
.IsRequired();
b.Property<DateTime>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<string>("UserId");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CircleId")
.IsRequired();
b.Property<string>("MemberId")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<string>("PerformerId")
.IsRequired();
b.Property<DateTime>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CommandId");
b.Property<string>("Description");
b.Property<int?>("Status");
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.Property<string>("PerfomerId");
b.Property<bool>("AcceptGeoLocalisation");
b.Property<bool>("AcceptNotifications");
b.Property<bool>("AcceptPublicContact");
b.Property<bool>("Active");
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<int>("DailyCost");
b.Property<int>("Rate");
b.Property<string>("WebSite");
b.HasKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.HasOne("YavscWeb.Models.AccountHistory")
.WithMany()
.HasForeignKey("HistoryId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithOne()
.HasForeignKey("YavscWeb.Models.AccountBalance", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("AuthorId");
});
modelBuilder.Entity("YavscWeb.Models.Booking.SimpleBookQuery", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.HasOne("YavscWeb.Models.Circle")
.WithMany()
.HasForeignKey("CircleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("MemberId");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerfomerId");
});
}
}
}

@ -0,0 +1,414 @@
using System;
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class init : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AspNetRoles",
columns: table => new
{
Id = table.Column<string>(nullable: false),
ConcurrencyStamp = table.Column<string>(nullable: true),
Name = table.Column<string>(nullable: true),
NormalizedName = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityRole", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Location",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
Address = table.Column<string>(nullable: false),
Latitude = table.Column<double>(nullable: false),
Longitude = table.Column<double>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Location", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AccountHistory",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true)
},
constraints: table =>
{
table.PrimaryKey("PK_AccountHistory", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Activity",
columns: table => new
{
Code = table.Column<string>(nullable: false),
Description = table.Column<string>(nullable: true),
Name = table.Column<string>(nullable: false),
Photo = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Activity", x => x.Code);
});
migrationBuilder.CreateTable(
name: "AspNetUsers",
columns: table => new
{
Id = table.Column<string>(nullable: false),
AccessFailedCount = table.Column<int>(nullable: false),
ConcurrencyStamp = table.Column<string>(nullable: true),
Email = table.Column<string>(nullable: true),
EmailConfirmed = table.Column<bool>(nullable: false),
LockoutEnabled = table.Column<bool>(nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(nullable: true),
NormalizedEmail = table.Column<string>(nullable: true),
NormalizedUserName = table.Column<string>(nullable: true),
PasswordHash = table.Column<string>(nullable: true),
PhoneNumber = table.Column<string>(nullable: true),
PhoneNumberConfirmed = table.Column<bool>(nullable: false),
SecurityStamp = table.Column<string>(nullable: true),
TwoFactorEnabled = table.Column<bool>(nullable: false),
UserName = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ApplicationUser", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Circle",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
Name = table.Column<string>(nullable: true),
UserId = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Circle", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Skill",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
Name = table.Column<string>(nullable: true),
Rate = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Skill", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AspNetRoleClaims",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:Serial", true),
ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true),
RoleId = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityRoleClaim<string>", x => x.Id);
table.ForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
column: x => x.RoleId,
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserClaims",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:Serial", true),
ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true),
UserId = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityUserClaim<string>", x => x.Id);
table.ForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserLogins",
columns: table => new
{
LoginProvider = table.Column<string>(nullable: false),
ProviderKey = table.Column<string>(nullable: false),
ProviderDisplayName = table.Column<string>(nullable: true),
UserId = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityUserLogin<string>", x => new { x.LoginProvider, x.ProviderKey });
table.ForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserRoles",
columns: table => new
{
UserId = table.Column<string>(nullable: false),
RoleId = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityUserRole<string>", x => new { x.UserId, x.RoleId });
table.ForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
column: x => x.RoleId,
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AccountBalance",
columns: table => new
{
UserId = table.Column<string>(nullable: false),
Credits = table.Column<long>(nullable: false),
HistoryId = table.Column<long>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AccountBalance", x => x.UserId);
table.ForeignKey(
name: "FK_AccountBalance_AccountHistory_HistoryId",
column: x => x.HistoryId,
principalTable: "AccountHistory",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Blog",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
AuthorId = table.Column<string>(nullable: false),
bcontent = table.Column<string>(nullable: true),
modified = table.Column<DateTime>(nullable: false),
photo = table.Column<string>(nullable: true),
posted = table.Column<DateTime>(nullable: false),
rate = table.Column<int>(nullable: false),
title = table.Column<string>(nullable: true),
visible = table.Column<bool>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Blog", x => x.Id);
table.ForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
column: x => x.AuthorId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "SimpleBookQuery",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
ClientId = table.Column<string>(nullable: false),
EventDate = table.Column<DateTime>(nullable: false),
LocationId = table.Column<long>(nullable: false),
PerformerId = table.Column<string>(nullable: false),
ValidationDate = table.Column<DateTime>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SimpleBookQuery", x => x.Id);
table.ForeignKey(
name: "FK_SimpleBookQuery_ApplicationUser_ClientId",
column: x => x.ClientId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_SimpleBookQuery_Location_LocationId",
column: x => x.LocationId,
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_SimpleBookQuery_ApplicationUser_PerformerId",
column: x => x.PerformerId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Command",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
ClientId = table.Column<string>(nullable: false),
PerformerId = table.Column<string>(nullable: false),
ValidationDate = table.Column<DateTime>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Command", x => x.Id);
table.ForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
column: x => x.ClientId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Command_ApplicationUser_PerformerId",
column: x => x.PerformerId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "PerformerProfile",
columns: table => new
{
PerfomerId = table.Column<string>(nullable: false),
AcceptGeoLocalisation = table.Column<bool>(nullable: false),
AcceptNotifications = table.Column<bool>(nullable: false),
AcceptPublicContact = table.Column<bool>(nullable: false),
Active = table.Column<bool>(nullable: false),
ActivityCode = table.Column<string>(nullable: false),
DailyCost = table.Column<int>(nullable: false),
Rate = table.Column<int>(nullable: false),
WebSite = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PerformerProfile", x => x.PerfomerId);
table.ForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
column: x => x.ActivityCode,
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
column: x => x.PerfomerId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CircleMember",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
CircleId = table.Column<long>(nullable: false),
MemberId = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CircleMember", x => x.Id);
table.ForeignKey(
name: "FK_CircleMember_Circle_CircleId",
column: x => x.CircleId,
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
column: x => x.MemberId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Estimate",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
CommandId = table.Column<long>(nullable: true),
Description = table.Column<string>(nullable: true),
Status = table.Column<int>(nullable: true),
Title = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Estimate", x => x.Id);
table.ForeignKey(
name: "FK_Estimate_Command_CommandId",
column: x => x.CommandId,
principalTable: "Command",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "RoleNameIndex",
table: "AspNetRoles",
column: "NormalizedName");
migrationBuilder.CreateIndex(
name: "EmailIndex",
table: "AspNetUsers",
column: "NormalizedEmail");
migrationBuilder.CreateIndex(
name: "UserNameIndex",
table: "AspNetUsers",
column: "NormalizedUserName");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable("AspNetRoleClaims");
migrationBuilder.DropTable("AspNetUserClaims");
migrationBuilder.DropTable("AspNetUserLogins");
migrationBuilder.DropTable("AspNetUserRoles");
migrationBuilder.DropTable("AccountBalance");
migrationBuilder.DropTable("Blog");
migrationBuilder.DropTable("SimpleBookQuery");
migrationBuilder.DropTable("CircleMember");
migrationBuilder.DropTable("Estimate");
migrationBuilder.DropTable("PerformerProfile");
migrationBuilder.DropTable("Skill");
migrationBuilder.DropTable("AspNetRoles");
migrationBuilder.DropTable("AccountHistory");
migrationBuilder.DropTable("Location");
migrationBuilder.DropTable("Circle");
migrationBuilder.DropTable("Command");
migrationBuilder.DropTable("Activity");
migrationBuilder.DropTable("AspNetUsers");
}
}
}

@ -0,0 +1,452 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models;
namespace Yavsc.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20160317215718_command")]
partial class command
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "7.0.0-rc1-16348");
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasAnnotation("Relational:Name", "RoleNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasAnnotation("Relational:TableName", "AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
});
modelBuilder.Entity("YavscWeb.Location", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address")
.IsRequired();
b.Property<double>("Latitude");
b.Property<double>("Longitude");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.Property<string>("UserId");
b.Property<long>("Credits");
b.Property<long>("HistoryId");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.AccountHistory", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Activity", b =>
{
b.Property<string>("Code")
.HasAnnotation("MaxLength", 512);
b.Property<string>("Description");
b.Property<string>("Name")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<string>("Photo");
b.HasKey("Code");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasAnnotation("Relational:Name", "EmailIndex");
b.HasIndex("NormalizedUserName")
.HasAnnotation("Relational:Name", "UserNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetUsers");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AuthorId")
.IsRequired();
b.Property<string>("bcontent");
b.Property<DateTime>("modified");
b.Property<string>("photo");
b.Property<DateTime>("posted");
b.Property<int>("rate");
b.Property<string>("title");
b.Property<bool>("visible");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Book.Query", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("EventDate");
b.Property<decimal?>("Final");
b.Property<long?>("LocationId")
.IsRequired();
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<string>("UserId");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CircleId")
.IsRequired();
b.Property<string>("MemberId")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<decimal?>("Final");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CommandId");
b.Property<string>("Description");
b.Property<int?>("Status");
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.Property<string>("PerfomerId");
b.Property<bool>("AcceptGeoLocalisation");
b.Property<bool>("AcceptNotifications");
b.Property<bool>("AcceptPublicContact");
b.Property<bool>("Active");
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<int>("DailyCost");
b.Property<int>("Rate");
b.Property<string>("WebSite");
b.HasKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.HasOne("YavscWeb.Models.AccountHistory")
.WithMany()
.HasForeignKey("HistoryId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithOne()
.HasForeignKey("YavscWeb.Models.AccountBalance", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("AuthorId");
});
modelBuilder.Entity("YavscWeb.Models.Book.Query", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.HasOne("YavscWeb.Models.Circle")
.WithMany()
.HasForeignKey("CircleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("MemberId");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerfomerId");
});
}
}
}

@ -0,0 +1,330 @@
using System;
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class command : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_AccountHistory_HistoryId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.DropTable("SimpleBookQuery");
migrationBuilder.CreateTable(
name: "Query",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
ClientId = table.Column<string>(nullable: false),
EventDate = table.Column<DateTime>(nullable: false),
Final = table.Column<decimal>(nullable: true),
LocationId = table.Column<long>(nullable: false),
PerformerId = table.Column<string>(nullable: false),
Previsional = table.Column<decimal>(nullable: true),
ValidationDate = table.Column<DateTime>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Query", x => x.Id);
table.ForeignKey(
name: "FK_Query_ApplicationUser_ClientId",
column: x => x.ClientId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Query_Location_LocationId",
column: x => x.LocationId,
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Query_ApplicationUser_PerformerId",
column: x => x.PerformerId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.AlterColumn<DateTime>(
name: "ValidationDate",
table: "Command",
nullable: true);
migrationBuilder.AddColumn<decimal>(
name: "Final",
table: "Command",
nullable: true);
migrationBuilder.AddColumn<decimal>(
name: "Previsional",
table: "Command",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_AccountHistory_HistoryId",
table: "AccountBalance",
column: "HistoryId",
principalTable: "AccountHistory",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_AccountHistory_HistoryId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "Final", table: "Command");
migrationBuilder.DropColumn(name: "Previsional", table: "Command");
migrationBuilder.DropTable("Query");
migrationBuilder.CreateTable(
name: "SimpleBookQuery",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
ClientId = table.Column<string>(nullable: false),
EventDate = table.Column<DateTime>(nullable: false),
LocationId = table.Column<long>(nullable: false),
PerformerId = table.Column<string>(nullable: false),
ValidationDate = table.Column<DateTime>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SimpleBookQuery", x => x.Id);
table.ForeignKey(
name: "FK_SimpleBookQuery_ApplicationUser_ClientId",
column: x => x.ClientId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_SimpleBookQuery_Location_LocationId",
column: x => x.LocationId,
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_SimpleBookQuery_ApplicationUser_PerformerId",
column: x => x.PerformerId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.AlterColumn<DateTime>(
name: "ValidationDate",
table: "Command",
nullable: false);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_AccountHistory_HistoryId",
table: "AccountBalance",
column: "HistoryId",
principalTable: "AccountHistory",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

@ -0,0 +1,485 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models;
namespace Yavsc.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20160320170252_bank")]
partial class bank
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "7.0.0-rc1-16348");
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasAnnotation("Relational:Name", "RoleNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasAnnotation("Relational:TableName", "AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
});
modelBuilder.Entity("YavscWeb.Location", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address")
.IsRequired();
b.Property<double>("Latitude");
b.Property<double>("Longitude");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.Property<string>("UserId");
b.Property<long>("Credits");
b.Property<long>("HistoryId");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.AccountHistory", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Activity", b =>
{
b.Property<string>("Code")
.HasAnnotation("MaxLength", 512);
b.Property<string>("Description");
b.Property<string>("Name")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<string>("Photo");
b.HasKey("Code");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasAnnotation("Relational:Name", "EmailIndex");
b.HasIndex("NormalizedUserName")
.HasAnnotation("Relational:Name", "UserNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetUsers");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("ExecDate");
b.Property<long>("Impact");
b.Property<string>("Reason")
.IsRequired();
b.Property<long>("TargetId");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AuthorId")
.IsRequired();
b.Property<string>("bcontent");
b.Property<DateTime>("modified");
b.Property<string>("photo");
b.Property<DateTime>("posted");
b.Property<int>("rate");
b.Property<string>("title");
b.Property<bool>("visible");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Book.Query", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("EventDate");
b.Property<decimal?>("Final");
b.Property<long>("LocationId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<string>("UserId");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CircleId")
.IsRequired();
b.Property<string>("MemberId")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<decimal?>("Final");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CommandId");
b.Property<string>("Description");
b.Property<int?>("Status");
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.Property<string>("PerfomerId");
b.Property<bool>("AcceptGeoLocalisation");
b.Property<bool>("AcceptNotifications");
b.Property<bool>("AcceptPublicContact");
b.Property<bool>("Active");
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<int>("DailyCost");
b.Property<long>("OrganisationAddressId");
b.Property<int>("Rate");
b.Property<string>("SIRET")
.IsRequired()
.HasAnnotation("MaxLength", 14);
b.Property<string>("WebSite");
b.HasKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.HasOne("YavscWeb.Models.AccountHistory")
.WithMany()
.HasForeignKey("HistoryId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithOne()
.HasForeignKey("YavscWeb.Models.AccountBalance", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.HasOne("YavscWeb.Models.AccountHistory")
.WithMany()
.HasForeignKey("TargetId");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("AuthorId");
});
modelBuilder.Entity("YavscWeb.Models.Book.Query", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.HasOne("YavscWeb.Models.Circle")
.WithMany()
.HasForeignKey("CircleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("MemberId");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("OrganisationAddressId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerfomerId");
});
}
}
}

@ -0,0 +1,334 @@
using System;
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class bank : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_AccountHistory_HistoryId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_Query_ApplicationUser_ClientId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_Location_LocationId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_ApplicationUser_PerformerId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.CreateTable(
name: "BalanceImpact",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
ExecDate = table.Column<DateTime>(nullable: false),
Impact = table.Column<long>(nullable: false),
Reason = table.Column<string>(nullable: false),
TargetId = table.Column<long>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BalanceImpact", x => x.Id);
table.ForeignKey(
name: "FK_BalanceImpact_AccountHistory_TargetId",
column: x => x.TargetId,
principalTable: "AccountHistory",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.AddColumn<long>(
name: "OrganisationAddressId",
table: "PerformerProfile",
nullable: false,
defaultValue: 0L);
migrationBuilder.AddColumn<string>(
name: "SIRET",
table: "PerformerProfile",
nullable: false,
defaultValue: "");
migrationBuilder.Sql("delete from \"PerformerProfile\"" );
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_AccountHistory_HistoryId",
table: "AccountBalance",
column: "HistoryId",
principalTable: "AccountHistory",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Query_ApplicationUser_ClientId",
table: "Query",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Query_Location_LocationId",
table: "Query",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Query_ApplicationUser_PerformerId",
table: "Query",
column: "PerformerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganisationAddressId",
table: "PerformerProfile",
column: "OrganisationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_AccountHistory_HistoryId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_Query_ApplicationUser_ClientId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_Location_LocationId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_ApplicationUser_PerformerId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "SIRET", table: "PerformerProfile");
migrationBuilder.DropTable("BalanceImpact");
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_AccountHistory_HistoryId",
table: "AccountBalance",
column: "HistoryId",
principalTable: "AccountHistory",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Query_ApplicationUser_ClientId",
table: "Query",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Query_Location_LocationId",
table: "Query",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Query_ApplicationUser_PerformerId",
table: "Query",
column: "PerformerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

@ -0,0 +1,592 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models;
namespace Yavsc.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20160322144500_contact")]
partial class contact
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "7.0.0-rc1-16348");
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasAnnotation("Relational:Name", "RoleNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasAnnotation("Relational:TableName", "AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
});
modelBuilder.Entity("YavscWeb.Location", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address")
.IsRequired();
b.Property<double>("Latitude");
b.Property<double>("Longitude");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.Property<string>("UserId");
b.Property<long>("Credits");
b.Property<long>("HistoryId");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.AccountHistory", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Activity", b =>
{
b.Property<string>("Code")
.HasAnnotation("MaxLength", 512);
b.Property<string>("Description");
b.Property<string>("Name")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<string>("Photo");
b.HasKey("Code");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<long?>("PostalAddressId");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasAnnotation("Relational:Name", "EmailIndex");
b.HasIndex("NormalizedUserName")
.HasAnnotation("Relational:Name", "UserNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetUsers");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("ExecDate");
b.Property<long>("Impact");
b.Property<string>("Reason")
.IsRequired();
b.Property<long>("TargetId");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.BaseProduct", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("Name");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AuthorId")
.IsRequired();
b.Property<string>("bcontent");
b.Property<DateTime>("modified");
b.Property<string>("photo");
b.Property<DateTime>("posted");
b.Property<int>("rate");
b.Property<string>("title");
b.Property<bool>("visible");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Book.Query", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("EventDate");
b.Property<int>("Lag");
b.Property<long>("LocationId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<string>("UserId");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CircleId")
.IsRequired();
b.Property<string>("MemberId")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<int>("Lag");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ArticleId");
b.Property<long?>("CommandId");
b.Property<string>("Comment");
b.Property<int>("Count");
b.Property<long?>("EstimateId");
b.Property<long?>("QueryId");
b.Property<decimal>("UnitaryCost");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.Property<string>("OwnerId");
b.Property<string>("UserId");
b.HasKey("OwnerId", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CommandId");
b.Property<string>("Description");
b.Property<int?>("Status");
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.Property<string>("PerfomerId");
b.Property<bool>("AcceptGeoLocalisation");
b.Property<bool>("AcceptNotifications");
b.Property<bool>("AcceptPublicContact");
b.Property<bool>("Active");
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<int>("DailyCost");
b.Property<long>("OrganisationAddressId");
b.Property<int>("Rate");
b.Property<string>("SIRET")
.IsRequired()
.HasAnnotation("MaxLength", 14);
b.Property<string>("WebSite");
b.HasKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ContextId");
b.Property<decimal>("Depth");
b.Property<string>("Description");
b.Property<decimal>("Height");
b.Property<string>("Name");
b.Property<decimal>("Weight");
b.Property<decimal>("Width");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.HasOne("YavscWeb.Models.AccountHistory")
.WithMany()
.HasForeignKey("HistoryId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithOne()
.HasForeignKey("YavscWeb.Models.AccountBalance", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("PostalAddressId");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.HasOne("YavscWeb.Models.AccountHistory")
.WithMany()
.HasForeignKey("TargetId");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("AuthorId");
});
modelBuilder.Entity("YavscWeb.Models.Book.Query", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.HasOne("YavscWeb.Models.Circle")
.WithMany()
.HasForeignKey("CircleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("MemberId");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.HasOne("YavscWeb.Models.BaseProduct")
.WithMany()
.HasForeignKey("ArticleId");
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
b.HasOne("YavscWeb.Models.Estimate")
.WithMany()
.HasForeignKey("EstimateId");
b.HasOne("YavscWeb.Models.Book.Query")
.WithMany()
.HasForeignKey("QueryId");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("OrganisationAddressId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ContextId");
});
}
}
}

@ -0,0 +1,455 @@
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class contact : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_AccountHistory_HistoryId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountHistory_TargetId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_Query_ApplicationUser_ClientId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_Location_LocationId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_ApplicationUser_PerformerId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "Final", table: "Command");
migrationBuilder.DropColumn(name: "Final", table: "Query");
migrationBuilder.CreateTable(
name: "BaseProduct",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
Description = table.Column<string>(nullable: true),
Name = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_BaseProduct", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Contact",
columns: table => new
{
OwnerId = table.Column<string>(nullable: false),
UserId = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Contact", x => new { x.OwnerId, x.UserId });
table.ForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
column: x => x.OwnerId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Service",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
ContextId = table.Column<string>(nullable: true),
Depth = table.Column<decimal>(nullable: false),
Description = table.Column<string>(nullable: true),
Height = table.Column<decimal>(nullable: false),
Name = table.Column<string>(nullable: true),
Weight = table.Column<decimal>(nullable: false),
Width = table.Column<decimal>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Service", x => x.Id);
table.ForeignKey(
name: "FK_Service_Activity_ContextId",
column: x => x.ContextId,
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "CommandLine",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
ArticleId = table.Column<long>(nullable: true),
CommandId = table.Column<long>(nullable: true),
Comment = table.Column<string>(nullable: true),
Count = table.Column<int>(nullable: false),
EstimateId = table.Column<long>(nullable: true),
QueryId = table.Column<long>(nullable: true),
UnitaryCost = table.Column<decimal>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CommandLine", x => x.Id);
table.ForeignKey(
name: "FK_CommandLine_BaseProduct_ArticleId",
column: x => x.ArticleId,
principalTable: "BaseProduct",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_CommandLine_Command_CommandId",
column: x => x.CommandId,
principalTable: "Command",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_CommandLine_Estimate_EstimateId",
column: x => x.EstimateId,
principalTable: "Estimate",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_CommandLine_Query_QueryId",
column: x => x.QueryId,
principalTable: "Query",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.AddColumn<int>(
name: "Lag",
table: "Command",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "Lag",
table: "Query",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<long>(
name: "PostalAddressId",
table: "AspNetUsers",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_AccountHistory_HistoryId",
table: "AccountBalance",
column: "HistoryId",
principalTable: "AccountHistory",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_ApplicationUser_Location_PostalAddressId",
table: "AspNetUsers",
column: "PostalAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountHistory_TargetId",
table: "BalanceImpact",
column: "TargetId",
principalTable: "AccountHistory",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Query_ApplicationUser_ClientId",
table: "Query",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Query_Location_LocationId",
table: "Query",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Query_PerformerProfile_PerformerId",
table: "Query",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_PerformerProfile_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganisationAddressId",
table: "PerformerProfile",
column: "OrganisationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_AccountHistory_HistoryId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_ApplicationUser_Location_PostalAddressId", table: "AspNetUsers");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountHistory_TargetId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_Query_ApplicationUser_ClientId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_Location_LocationId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_PerformerProfile_PerformerId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_PerformerProfile_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "Lag", table: "Command");
migrationBuilder.DropColumn(name: "Lag", table: "Query");
migrationBuilder.DropColumn(name: "PostalAddressId", table: "AspNetUsers");
migrationBuilder.DropTable("CommandLine");
migrationBuilder.DropTable("Contact");
migrationBuilder.DropTable("Service");
migrationBuilder.DropTable("BaseProduct");
migrationBuilder.AddColumn<decimal>(
name: "Final",
table: "Command",
nullable: true);
migrationBuilder.AddColumn<decimal>(
name: "Final",
table: "Query",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_AccountHistory_HistoryId",
table: "AccountBalance",
column: "HistoryId",
principalTable: "AccountHistory",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountHistory_TargetId",
table: "BalanceImpact",
column: "TargetId",
principalTable: "AccountHistory",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Query_ApplicationUser_ClientId",
table: "Query",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Query_Location_LocationId",
table: "Query",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Query_ApplicationUser_PerformerId",
table: "Query",
column: "PerformerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganisationAddressId",
table: "PerformerProfile",
column: "OrganisationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

@ -0,0 +1,579 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models;
namespace Yavsc.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20160322152206_balance")]
partial class balance
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "7.0.0-rc1-16348");
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasAnnotation("Relational:Name", "RoleNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasAnnotation("Relational:TableName", "AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
});
modelBuilder.Entity("YavscWeb.Location", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address")
.IsRequired();
b.Property<double>("Latitude");
b.Property<double>("Longitude");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.Property<string>("UserId");
b.Property<decimal>("Credits");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.Activity", b =>
{
b.Property<string>("Code")
.HasAnnotation("MaxLength", 512);
b.Property<string>("Description");
b.Property<string>("Name")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<string>("Photo");
b.HasKey("Code");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<long?>("PostalAddressId");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasAnnotation("Relational:Name", "EmailIndex");
b.HasIndex("NormalizedUserName")
.HasAnnotation("Relational:Name", "UserNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetUsers");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BalanceId")
.IsRequired();
b.Property<DateTime>("ExecDate");
b.Property<decimal>("Impact");
b.Property<string>("Reason")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.BaseProduct", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("Name");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AuthorId")
.IsRequired();
b.Property<string>("bcontent");
b.Property<DateTime>("modified");
b.Property<string>("photo");
b.Property<DateTime>("posted");
b.Property<int>("rate");
b.Property<string>("title");
b.Property<bool>("visible");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Book.Query", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("EventDate");
b.Property<int>("Lag");
b.Property<long>("LocationId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<string>("UserId");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CircleId")
.IsRequired();
b.Property<string>("MemberId")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<int>("Lag");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ArticleId");
b.Property<long?>("CommandId");
b.Property<string>("Comment");
b.Property<int>("Count");
b.Property<long?>("EstimateId");
b.Property<long?>("QueryId");
b.Property<decimal>("UnitaryCost");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.Property<string>("OwnerId");
b.Property<string>("UserId");
b.HasKey("OwnerId", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CommandId");
b.Property<string>("Description");
b.Property<int?>("Status");
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.Property<string>("PerfomerId");
b.Property<bool>("AcceptGeoLocalisation");
b.Property<bool>("AcceptNotifications");
b.Property<bool>("AcceptPublicContact");
b.Property<bool>("Active");
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<int>("DailyCost");
b.Property<long>("OrganisationAddressId");
b.Property<int>("Rate");
b.Property<string>("SIRET")
.IsRequired()
.HasAnnotation("MaxLength", 14);
b.Property<string>("WebSite");
b.HasKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ContextId");
b.Property<decimal>("Depth");
b.Property<string>("Description");
b.Property<decimal>("Height");
b.Property<string>("Name");
b.Property<decimal>("Weight");
b.Property<decimal>("Width");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithOne()
.HasForeignKey("YavscWeb.Models.AccountBalance", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("PostalAddressId");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.HasOne("YavscWeb.Models.AccountBalance")
.WithMany()
.HasForeignKey("BalanceId");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("AuthorId");
});
modelBuilder.Entity("YavscWeb.Models.Book.Query", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.HasOne("YavscWeb.Models.Circle")
.WithMany()
.HasForeignKey("CircleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("MemberId");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.HasOne("YavscWeb.Models.BaseProduct")
.WithMany()
.HasForeignKey("ArticleId");
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
b.HasOne("YavscWeb.Models.Estimate")
.WithMany()
.HasForeignKey("EstimateId");
b.HasOne("YavscWeb.Models.Book.Query")
.WithMany()
.HasForeignKey("QueryId");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("OrganisationAddressId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ContextId");
});
}
}
}

@ -0,0 +1,373 @@
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class balance : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_AccountHistory_HistoryId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountHistory_TargetId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_Query_ApplicationUser_ClientId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_Location_LocationId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_PerformerProfile_PerformerId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_PerformerProfile_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "TargetId", table: "BalanceImpact");
migrationBuilder.DropColumn(name: "HistoryId", table: "AccountBalance");
migrationBuilder.DropTable("AccountHistory");
migrationBuilder.AlterColumn<decimal>(
name: "Impact",
table: "BalanceImpact",
nullable: false);
migrationBuilder.AddColumn<string>(
name: "BalanceId",
table: "BalanceImpact",
nullable: false,
defaultValue: "");
migrationBuilder.AlterColumn<decimal>(
name: "Credits",
table: "AccountBalance",
nullable: false);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Query_ApplicationUser_ClientId",
table: "Query",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Query_Location_LocationId",
table: "Query",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Query_PerformerProfile_PerformerId",
table: "Query",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_PerformerProfile_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganisationAddressId",
table: "PerformerProfile",
column: "OrganisationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_Query_ApplicationUser_ClientId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_Location_LocationId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_PerformerProfile_PerformerId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_PerformerProfile_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "BalanceId", table: "BalanceImpact");
migrationBuilder.CreateTable(
name: "AccountHistory",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true)
},
constraints: table =>
{
table.PrimaryKey("PK_AccountHistory", x => x.Id);
});
migrationBuilder.AlterColumn<long>(
name: "Impact",
table: "BalanceImpact",
nullable: false);
migrationBuilder.AddColumn<long>(
name: "TargetId",
table: "BalanceImpact",
nullable: false,
defaultValue: 0L);
migrationBuilder.AlterColumn<long>(
name: "Credits",
table: "AccountBalance",
nullable: false);
migrationBuilder.AddColumn<long>(
name: "HistoryId",
table: "AccountBalance",
nullable: false,
defaultValue: 0L);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_AccountHistory_HistoryId",
table: "AccountBalance",
column: "HistoryId",
principalTable: "AccountHistory",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountHistory_TargetId",
table: "BalanceImpact",
column: "TargetId",
principalTable: "AccountHistory",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Query_ApplicationUser_ClientId",
table: "Query",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Query_Location_LocationId",
table: "Query",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Query_PerformerProfile_PerformerId",
table: "Query",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_PerformerProfile_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganisationAddressId",
table: "PerformerProfile",
column: "OrganisationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

@ -0,0 +1,603 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models;
namespace Yavsc.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20160401233357_circle")]
partial class circle
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "7.0.0-rc1-16348");
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasAnnotation("Relational:Name", "RoleNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasAnnotation("Relational:TableName", "AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
});
modelBuilder.Entity("YavscWeb.Location", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address")
.IsRequired();
b.Property<double>("Latitude");
b.Property<double>("Longitude");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.Property<string>("UserId");
b.Property<decimal>("Credits");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.Activity", b =>
{
b.Property<string>("Code")
.HasAnnotation("MaxLength", 512);
b.Property<string>("Description");
b.Property<string>("Name")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<string>("Photo");
b.HasKey("Code");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<string>("GoogleRegId");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<long?>("PostalAddressId");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasAnnotation("Relational:Name", "EmailIndex");
b.HasIndex("NormalizedUserName")
.HasAnnotation("Relational:Name", "UserNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetUsers");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BalanceId")
.IsRequired();
b.Property<DateTime>("ExecDate");
b.Property<decimal>("Impact");
b.Property<string>("Reason")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.BaseProduct", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("Name");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AuthorId")
.IsRequired();
b.Property<string>("bcontent");
b.Property<DateTime>("modified");
b.Property<string>("photo");
b.Property<DateTime>("posted");
b.Property<int>("rate");
b.Property<string>("title");
b.Property<bool>("visible");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Book.Query", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("EventDate");
b.Property<int>("Lag");
b.Property<long>("LocationId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<string>("OwnerId");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CircleId")
.IsRequired();
b.Property<string>("MemberId")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<int>("Lag");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ArticleId");
b.Property<long?>("CommandId");
b.Property<string>("Comment");
b.Property<int>("Count");
b.Property<long?>("EstimateId");
b.Property<long?>("QueryId");
b.Property<decimal>("UnitaryCost");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.Property<string>("OwnerId");
b.Property<string>("UserId");
b.HasKey("OwnerId", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CommandId");
b.Property<string>("Description");
b.Property<int?>("Status");
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.OAuth2Tokens", b =>
{
b.Property<string>("UserId");
b.Property<string>("AccessToken");
b.Property<DateTime>("Expiration");
b.Property<string>("RefreshToken");
b.Property<string>("TokenType");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.Property<string>("PerfomerId");
b.Property<bool>("AcceptGeoLocalisation");
b.Property<bool>("AcceptNotifications");
b.Property<bool>("AcceptPublicContact");
b.Property<bool>("Active");
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<int>("DailyCost");
b.Property<long>("OrganisationAddressId");
b.Property<int>("Rate");
b.Property<string>("SIRET")
.IsRequired()
.HasAnnotation("MaxLength", 14);
b.Property<string>("WebSite");
b.HasKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ContextId");
b.Property<decimal>("Depth");
b.Property<string>("Description");
b.Property<decimal>("Height");
b.Property<string>("Name");
b.Property<decimal>("Weight");
b.Property<decimal>("Width");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithOne()
.HasForeignKey("YavscWeb.Models.AccountBalance", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("PostalAddressId");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.HasOne("YavscWeb.Models.AccountBalance")
.WithMany()
.HasForeignKey("BalanceId");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("AuthorId");
});
modelBuilder.Entity("YavscWeb.Models.Book.Query", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.HasOne("YavscWeb.Models.Circle")
.WithMany()
.HasForeignKey("CircleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("MemberId");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.HasOne("YavscWeb.Models.BaseProduct")
.WithMany()
.HasForeignKey("ArticleId");
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
b.HasOne("YavscWeb.Models.Estimate")
.WithMany()
.HasForeignKey("EstimateId");
b.HasOne("YavscWeb.Models.Book.Query")
.WithMany()
.HasForeignKey("QueryId");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("OrganisationAddressId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ContextId");
});
}
}
}

@ -0,0 +1,358 @@
using System;
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class circle : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_Query_ApplicationUser_ClientId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_Location_LocationId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_PerformerProfile_PerformerId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_PerformerProfile_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "UserId", table: "Circle");
migrationBuilder.CreateTable(
name: "OAuth2Tokens",
columns: table => new
{
UserId = table.Column<string>(nullable: false),
AccessToken = table.Column<string>(nullable: true),
Expiration = table.Column<DateTime>(nullable: false),
RefreshToken = table.Column<string>(nullable: true),
TokenType = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_OAuth2Tokens", x => x.UserId);
});
migrationBuilder.AddColumn<string>(
name: "OwnerId",
table: "Circle",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "GoogleRegId",
table: "AspNetUsers",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Query_ApplicationUser_ClientId",
table: "Query",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Query_Location_LocationId",
table: "Query",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Query_PerformerProfile_PerformerId",
table: "Query",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Circle_ApplicationUser_OwnerId",
table: "Circle",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_PerformerProfile_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganisationAddressId",
table: "PerformerProfile",
column: "OrganisationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_Query_ApplicationUser_ClientId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_Location_LocationId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_PerformerProfile_PerformerId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Circle_ApplicationUser_OwnerId", table: "Circle");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_PerformerProfile_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "OwnerId", table: "Circle");
migrationBuilder.DropColumn(name: "GoogleRegId", table: "AspNetUsers");
migrationBuilder.DropTable("OAuth2Tokens");
migrationBuilder.AddColumn<string>(
name: "UserId",
table: "Circle",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Query_ApplicationUser_ClientId",
table: "Query",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Query_Location_LocationId",
table: "Query",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Query_PerformerProfile_PerformerId",
table: "Query",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_PerformerProfile_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganisationAddressId",
table: "PerformerProfile",
column: "OrganisationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

@ -0,0 +1,607 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models;
namespace Yavsc.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20160402135146_calendar")]
partial class calendar
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "7.0.0-rc1-16348");
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasAnnotation("Relational:Name", "RoleNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasAnnotation("Relational:TableName", "AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
});
modelBuilder.Entity("YavscWeb.Location", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address")
.IsRequired();
b.Property<double>("Latitude");
b.Property<double>("Longitude");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.Property<string>("UserId");
b.Property<long>("ContactCredits");
b.Property<decimal>("Credits");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.Activity", b =>
{
b.Property<string>("Code")
.HasAnnotation("MaxLength", 512);
b.Property<string>("Description");
b.Property<string>("Name")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<string>("Photo");
b.HasKey("Code");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("DedicatedGoogleCalendar");
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<string>("GoogleRegId");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<long?>("PostalAddressId");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasAnnotation("Relational:Name", "EmailIndex");
b.HasIndex("NormalizedUserName")
.HasAnnotation("Relational:Name", "UserNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetUsers");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BalanceId")
.IsRequired();
b.Property<DateTime>("ExecDate");
b.Property<decimal>("Impact");
b.Property<string>("Reason")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.BaseProduct", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("Name");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AuthorId")
.IsRequired();
b.Property<string>("bcontent");
b.Property<DateTime>("modified");
b.Property<string>("photo");
b.Property<DateTime>("posted");
b.Property<int>("rate");
b.Property<string>("title");
b.Property<bool>("visible");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Book.Query", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("EventDate");
b.Property<int>("Lag");
b.Property<long>("LocationId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<string>("OwnerId");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CircleId")
.IsRequired();
b.Property<string>("MemberId")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<int>("Lag");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ArticleId");
b.Property<long?>("CommandId");
b.Property<string>("Comment");
b.Property<int>("Count");
b.Property<long?>("EstimateId");
b.Property<long?>("QueryId");
b.Property<decimal>("UnitaryCost");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.Property<string>("OwnerId");
b.Property<string>("UserId");
b.HasKey("OwnerId", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CommandId");
b.Property<string>("Description");
b.Property<int?>("Status");
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.OAuth2Tokens", b =>
{
b.Property<string>("UserId");
b.Property<string>("AccessToken");
b.Property<DateTime>("Expiration");
b.Property<string>("RefreshToken");
b.Property<string>("TokenType");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.Property<string>("PerfomerId");
b.Property<bool>("AcceptGeoLocalisation");
b.Property<bool>("AcceptNotifications");
b.Property<bool>("AcceptPublicContact");
b.Property<bool>("Active");
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<int>("DailyCost");
b.Property<long>("OrganisationAddressId");
b.Property<int>("Rate");
b.Property<string>("SIRET")
.IsRequired()
.HasAnnotation("MaxLength", 14);
b.Property<string>("WebSite");
b.HasKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ContextId");
b.Property<decimal>("Depth");
b.Property<string>("Description");
b.Property<decimal>("Height");
b.Property<string>("Name");
b.Property<decimal>("Weight");
b.Property<decimal>("Width");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithOne()
.HasForeignKey("YavscWeb.Models.AccountBalance", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("PostalAddressId");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.HasOne("YavscWeb.Models.AccountBalance")
.WithMany()
.HasForeignKey("BalanceId");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("AuthorId");
});
modelBuilder.Entity("YavscWeb.Models.Book.Query", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.HasOne("YavscWeb.Models.Circle")
.WithMany()
.HasForeignKey("CircleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("MemberId");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.HasOne("YavscWeb.Models.BaseProduct")
.WithMany()
.HasForeignKey("ArticleId");
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
b.HasOne("YavscWeb.Models.Estimate")
.WithMany()
.HasForeignKey("EstimateId");
b.HasOne("YavscWeb.Models.Book.Query")
.WithMany()
.HasForeignKey("QueryId");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("OrganisationAddressId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ContextId");
});
}
}
}

@ -0,0 +1,330 @@
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class calendar : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_Query_ApplicationUser_ClientId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_Location_LocationId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_PerformerProfile_PerformerId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_PerformerProfile_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.AddColumn<string>(
name: "DedicatedGoogleCalendar",
table: "AspNetUsers",
nullable: true);
migrationBuilder.AddColumn<long>(
name: "ContactCredits",
table: "AccountBalance",
nullable: false,
defaultValue: 0L);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Query_ApplicationUser_ClientId",
table: "Query",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Query_Location_LocationId",
table: "Query",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Query_PerformerProfile_PerformerId",
table: "Query",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_PerformerProfile_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganisationAddressId",
table: "PerformerProfile",
column: "OrganisationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_Query_ApplicationUser_ClientId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_Location_LocationId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_PerformerProfile_PerformerId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_PerformerProfile_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "DedicatedGoogleCalendar", table: "AspNetUsers");
migrationBuilder.DropColumn(name: "ContactCredits", table: "AccountBalance");
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Query_ApplicationUser_ClientId",
table: "Query",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Query_Location_LocationId",
table: "Query",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Query_PerformerProfile_PerformerId",
table: "Query",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_PerformerProfile_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganisationAddressId",
table: "PerformerProfile",
column: "OrganisationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

@ -0,0 +1,611 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models;
namespace Yavsc.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20160404110708_files")]
partial class files
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "7.0.0-rc1-16348");
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasAnnotation("Relational:Name", "RoleNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasAnnotation("Relational:TableName", "AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
});
modelBuilder.Entity("YavscWeb.Location", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address")
.IsRequired();
b.Property<double>("Latitude");
b.Property<double>("Longitude");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.Property<string>("UserId");
b.Property<long>("ContactCredits");
b.Property<decimal>("Credits");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.Activity", b =>
{
b.Property<string>("Code")
.HasAnnotation("MaxLength", 512);
b.Property<string>("Description");
b.Property<string>("Name")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<string>("Photo");
b.HasKey("Code");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("DedicatedGoogleCalendar");
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<string>("GoogleRegId");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<long?>("PostalAddressId");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasAnnotation("Relational:Name", "EmailIndex");
b.HasIndex("NormalizedUserName")
.HasAnnotation("Relational:Name", "UserNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetUsers");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BalanceId")
.IsRequired();
b.Property<DateTime>("ExecDate");
b.Property<decimal>("Impact");
b.Property<string>("Reason")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.BaseProduct", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("Name");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AuthorId")
.IsRequired();
b.Property<string>("bcontent");
b.Property<DateTime>("modified");
b.Property<string>("photo");
b.Property<DateTime>("posted");
b.Property<int>("rate");
b.Property<string>("title");
b.Property<bool>("visible");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Book.Query", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("EventDate");
b.Property<int>("Lag");
b.Property<long>("LocationId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<string>("OwnerId");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CircleId")
.IsRequired();
b.Property<string>("MemberId")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<int>("Lag");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ArticleId");
b.Property<long?>("CommandId");
b.Property<string>("Comment");
b.Property<int>("Count");
b.Property<long?>("EstimateId");
b.Property<long?>("QueryId");
b.Property<decimal>("UnitaryCost");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.Property<string>("OwnerId");
b.Property<string>("UserId");
b.HasKey("OwnerId", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AttachedFiles");
b.Property<string>("AttachedGraphics");
b.Property<long?>("CommandId");
b.Property<string>("Description");
b.Property<int?>("Status");
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.OAuth2Tokens", b =>
{
b.Property<string>("UserId");
b.Property<string>("AccessToken");
b.Property<DateTime>("Expiration");
b.Property<string>("RefreshToken");
b.Property<string>("TokenType");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.Property<string>("PerfomerId");
b.Property<bool>("AcceptGeoLocalisation");
b.Property<bool>("AcceptNotifications");
b.Property<bool>("AcceptPublicContact");
b.Property<bool>("Active");
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<int>("DailyCost");
b.Property<long>("OrganisationAddressId");
b.Property<int>("Rate");
b.Property<string>("SIRET")
.IsRequired()
.HasAnnotation("MaxLength", 14);
b.Property<string>("WebSite");
b.HasKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ContextId");
b.Property<decimal>("Depth");
b.Property<string>("Description");
b.Property<decimal>("Height");
b.Property<string>("Name");
b.Property<decimal>("Weight");
b.Property<decimal>("Width");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithOne()
.HasForeignKey("YavscWeb.Models.AccountBalance", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("PostalAddressId");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.HasOne("YavscWeb.Models.AccountBalance")
.WithMany()
.HasForeignKey("BalanceId");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("AuthorId");
});
modelBuilder.Entity("YavscWeb.Models.Book.Query", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.HasOne("YavscWeb.Models.Circle")
.WithMany()
.HasForeignKey("CircleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("MemberId");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.HasOne("YavscWeb.Models.BaseProduct")
.WithMany()
.HasForeignKey("ArticleId");
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
b.HasOne("YavscWeb.Models.Estimate")
.WithMany()
.HasForeignKey("EstimateId");
b.HasOne("YavscWeb.Models.Book.Query")
.WithMany()
.HasForeignKey("QueryId");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("OrganisationAddressId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ContextId");
});
}
}
}

@ -0,0 +1,330 @@
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class files : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_Query_ApplicationUser_ClientId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_Location_LocationId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_PerformerProfile_PerformerId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_PerformerProfile_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.AddColumn<string>(
name: "AttachedFiles",
table: "Estimate",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "AttachedGraphics",
table: "Estimate",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Query_ApplicationUser_ClientId",
table: "Query",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Query_Location_LocationId",
table: "Query",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Query_PerformerProfile_PerformerId",
table: "Query",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_PerformerProfile_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganisationAddressId",
table: "PerformerProfile",
column: "OrganisationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_Query_ApplicationUser_ClientId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_Location_LocationId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_PerformerProfile_PerformerId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_PerformerProfile_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "AttachedFiles", table: "Estimate");
migrationBuilder.DropColumn(name: "AttachedGraphics", table: "Estimate");
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Query_ApplicationUser_ClientId",
table: "Query",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Query_Location_LocationId",
table: "Query",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Query_PerformerProfile_PerformerId",
table: "Query",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_PerformerProfile_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganisationAddressId",
table: "PerformerProfile",
column: "OrganisationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

@ -0,0 +1,611 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models;
namespace Yavsc.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20160404121446_estimate")]
partial class estimate
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "7.0.0-rc1-16348");
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasAnnotation("Relational:Name", "RoleNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasAnnotation("Relational:TableName", "AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
});
modelBuilder.Entity("YavscWeb.Location", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address")
.IsRequired();
b.Property<double>("Latitude");
b.Property<double>("Longitude");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.Property<string>("UserId");
b.Property<long>("ContactCredits");
b.Property<decimal>("Credits");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.Activity", b =>
{
b.Property<string>("Code")
.HasAnnotation("MaxLength", 512);
b.Property<string>("Description");
b.Property<string>("Name")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<string>("Photo");
b.HasKey("Code");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("DedicatedGoogleCalendar");
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<string>("GoogleRegId");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<long?>("PostalAddressId");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasAnnotation("Relational:Name", "EmailIndex");
b.HasIndex("NormalizedUserName")
.HasAnnotation("Relational:Name", "UserNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetUsers");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BalanceId")
.IsRequired();
b.Property<DateTime>("ExecDate");
b.Property<decimal>("Impact");
b.Property<string>("Reason")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.BaseProduct", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("Name");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AuthorId")
.IsRequired();
b.Property<string>("bcontent");
b.Property<DateTime>("modified");
b.Property<string>("photo");
b.Property<DateTime>("posted");
b.Property<int>("rate");
b.Property<string>("title");
b.Property<bool>("visible");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Book.Query", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("EventDate");
b.Property<int>("Lag");
b.Property<long>("LocationId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<string>("OwnerId");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CircleId")
.IsRequired();
b.Property<string>("MemberId")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<int>("Lag");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ArticleId");
b.Property<long?>("CommandId");
b.Property<string>("Comment");
b.Property<int>("Count");
b.Property<long?>("EstimateId");
b.Property<long?>("QueryId");
b.Property<decimal>("UnitaryCost");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.Property<string>("OwnerId");
b.Property<string>("UserId");
b.HasKey("OwnerId", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AttachedFilesString");
b.Property<string>("AttachedGraphicsString");
b.Property<long?>("CommandId");
b.Property<string>("Description");
b.Property<int?>("Status");
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.OAuth2Tokens", b =>
{
b.Property<string>("UserId");
b.Property<string>("AccessToken");
b.Property<DateTime>("Expiration");
b.Property<string>("RefreshToken");
b.Property<string>("TokenType");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.Property<string>("PerfomerId");
b.Property<bool>("AcceptGeoLocalisation");
b.Property<bool>("AcceptNotifications");
b.Property<bool>("AcceptPublicContact");
b.Property<bool>("Active");
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<int>("DailyCost");
b.Property<long>("OrganisationAddressId");
b.Property<int>("Rate");
b.Property<string>("SIRET")
.IsRequired()
.HasAnnotation("MaxLength", 14);
b.Property<string>("WebSite");
b.HasKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ContextId");
b.Property<decimal>("Depth");
b.Property<string>("Description");
b.Property<decimal>("Height");
b.Property<string>("Name");
b.Property<decimal>("Weight");
b.Property<decimal>("Width");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithOne()
.HasForeignKey("YavscWeb.Models.AccountBalance", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("PostalAddressId");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.HasOne("YavscWeb.Models.AccountBalance")
.WithMany()
.HasForeignKey("BalanceId");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("AuthorId");
});
modelBuilder.Entity("YavscWeb.Models.Book.Query", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.HasOne("YavscWeb.Models.Circle")
.WithMany()
.HasForeignKey("CircleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("MemberId");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.HasOne("YavscWeb.Models.BaseProduct")
.WithMany()
.HasForeignKey("ArticleId");
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
b.HasOne("YavscWeb.Models.Estimate")
.WithMany()
.HasForeignKey("EstimateId");
b.HasOne("YavscWeb.Models.Book.Query")
.WithMany()
.HasForeignKey("QueryId");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("OrganisationAddressId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ContextId");
});
}
}
}

@ -0,0 +1,339 @@
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class estimate : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_Query_ApplicationUser_ClientId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_Location_LocationId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_PerformerProfile_PerformerId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_PerformerProfile_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "AttachedFiles", table: "Estimate");
migrationBuilder.DropColumn(name: "AttachedGraphics", table: "Estimate");
migrationBuilder.AddColumn<string>(
name: "AttachedFilesString",
table: "Estimate",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "AttachedGraphicsString",
table: "Estimate",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Query_ApplicationUser_ClientId",
table: "Query",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Query_Location_LocationId",
table: "Query",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Query_PerformerProfile_PerformerId",
table: "Query",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_PerformerProfile_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganisationAddressId",
table: "PerformerProfile",
column: "OrganisationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_Query_ApplicationUser_ClientId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_Location_LocationId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_PerformerProfile_PerformerId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_PerformerProfile_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "AttachedFilesString", table: "Estimate");
migrationBuilder.DropColumn(name: "AttachedGraphicsString", table: "Estimate");
migrationBuilder.AddColumn<string>(
name: "AttachedFiles",
table: "Estimate",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "AttachedGraphics",
table: "Estimate",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Query_ApplicationUser_ClientId",
table: "Query",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Query_Location_LocationId",
table: "Query",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Query_PerformerProfile_PerformerId",
table: "Query",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_PerformerProfile_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganisationAddressId",
table: "PerformerProfile",
column: "OrganisationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

@ -0,0 +1,611 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models;
namespace Yavsc.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20160404130359_estimateCommand")]
partial class estimateCommand
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "7.0.0-rc1-16348");
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasAnnotation("Relational:Name", "RoleNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasAnnotation("Relational:TableName", "AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
});
modelBuilder.Entity("YavscWeb.Location", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address")
.IsRequired();
b.Property<double>("Latitude");
b.Property<double>("Longitude");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.Property<string>("UserId");
b.Property<long>("ContactCredits");
b.Property<decimal>("Credits");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.Activity", b =>
{
b.Property<string>("Code")
.HasAnnotation("MaxLength", 512);
b.Property<string>("Description");
b.Property<string>("Name")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<string>("Photo");
b.HasKey("Code");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("DedicatedGoogleCalendar");
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<string>("GoogleRegId");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<long?>("PostalAddressId");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasAnnotation("Relational:Name", "EmailIndex");
b.HasIndex("NormalizedUserName")
.HasAnnotation("Relational:Name", "UserNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetUsers");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BalanceId")
.IsRequired();
b.Property<DateTime>("ExecDate");
b.Property<decimal>("Impact");
b.Property<string>("Reason")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.BaseProduct", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("Name");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AuthorId")
.IsRequired();
b.Property<string>("bcontent");
b.Property<DateTime>("modified");
b.Property<string>("photo");
b.Property<DateTime>("posted");
b.Property<int>("rate");
b.Property<string>("title");
b.Property<bool>("visible");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Book.Query", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("EventDate");
b.Property<int>("Lag");
b.Property<long>("LocationId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<string>("OwnerId");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CircleId")
.IsRequired();
b.Property<string>("MemberId")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<int>("Lag");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ArticleId");
b.Property<long?>("CommandId");
b.Property<string>("Comment");
b.Property<int>("Count");
b.Property<long?>("EstimateId");
b.Property<long?>("QueryId");
b.Property<decimal>("UnitaryCost");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.Property<string>("OwnerId");
b.Property<string>("UserId");
b.HasKey("OwnerId", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AttachedFilesString");
b.Property<string>("AttachedGraphicsString");
b.Property<long?>("CommandId");
b.Property<string>("Description");
b.Property<int?>("Status");
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.OAuth2Tokens", b =>
{
b.Property<string>("UserId");
b.Property<string>("AccessToken");
b.Property<DateTime>("Expiration");
b.Property<string>("RefreshToken");
b.Property<string>("TokenType");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.Property<string>("PerfomerId");
b.Property<bool>("AcceptGeoLocalisation");
b.Property<bool>("AcceptNotifications");
b.Property<bool>("AcceptPublicContact");
b.Property<bool>("Active");
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<int>("DailyCost");
b.Property<long>("OrganisationAddressId");
b.Property<int>("Rate");
b.Property<string>("SIRET")
.IsRequired()
.HasAnnotation("MaxLength", 14);
b.Property<string>("WebSite");
b.HasKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ContextId");
b.Property<decimal>("Depth");
b.Property<string>("Description");
b.Property<decimal>("Height");
b.Property<string>("Name");
b.Property<decimal>("Weight");
b.Property<decimal>("Width");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithOne()
.HasForeignKey("YavscWeb.Models.AccountBalance", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("PostalAddressId");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.HasOne("YavscWeb.Models.AccountBalance")
.WithMany()
.HasForeignKey("BalanceId");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("AuthorId");
});
modelBuilder.Entity("YavscWeb.Models.Book.Query", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.HasOne("YavscWeb.Models.Circle")
.WithMany()
.HasForeignKey("CircleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("MemberId");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.HasOne("YavscWeb.Models.BaseProduct")
.WithMany()
.HasForeignKey("ArticleId");
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
b.HasOne("YavscWeb.Models.Estimate")
.WithMany()
.HasForeignKey("EstimateId");
b.HasOne("YavscWeb.Models.Book.Query")
.WithMany()
.HasForeignKey("QueryId");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("OrganisationAddressId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ContextId");
});
}
}
}

@ -0,0 +1,319 @@
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class estimateCommand : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_Query_ApplicationUser_ClientId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_Location_LocationId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_PerformerProfile_PerformerId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_PerformerProfile_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Query_ApplicationUser_ClientId",
table: "Query",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Query_Location_LocationId",
table: "Query",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Query_PerformerProfile_PerformerId",
table: "Query",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_PerformerProfile_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganisationAddressId",
table: "PerformerProfile",
column: "OrganisationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_Query_ApplicationUser_ClientId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_Location_LocationId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_Query_PerformerProfile_PerformerId", table: "Query");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_PerformerProfile_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Query_ApplicationUser_ClientId",
table: "Query",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Query_Location_LocationId",
table: "Query",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Query_PerformerProfile_PerformerId",
table: "Query",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_PerformerProfile_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganisationAddressId",
table: "PerformerProfile",
column: "OrganisationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

@ -0,0 +1,611 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models;
namespace Yavsc.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20160405091432_booking")]
partial class booking
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "7.0.0-rc1-16348");
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasAnnotation("Relational:Name", "RoleNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasAnnotation("Relational:TableName", "AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
});
modelBuilder.Entity("YavscWeb.Location", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address")
.IsRequired();
b.Property<double>("Latitude");
b.Property<double>("Longitude");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.Property<string>("UserId");
b.Property<long>("ContactCredits");
b.Property<decimal>("Credits");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.Activity", b =>
{
b.Property<string>("Code")
.HasAnnotation("MaxLength", 512);
b.Property<string>("Description");
b.Property<string>("Name")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<string>("Photo");
b.HasKey("Code");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("DedicatedGoogleCalendar");
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<string>("GoogleRegId");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<long?>("PostalAddressId");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasAnnotation("Relational:Name", "EmailIndex");
b.HasIndex("NormalizedUserName")
.HasAnnotation("Relational:Name", "UserNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetUsers");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BalanceId")
.IsRequired();
b.Property<DateTime>("ExecDate");
b.Property<decimal>("Impact");
b.Property<string>("Reason")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.BaseProduct", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("Name");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AuthorId")
.IsRequired();
b.Property<string>("bcontent");
b.Property<DateTime>("modified");
b.Property<string>("photo");
b.Property<DateTime>("posted");
b.Property<int>("rate");
b.Property<string>("title");
b.Property<bool>("visible");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Book.BookQuery", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("EventDate");
b.Property<int>("Lag");
b.Property<long>("LocationId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<string>("OwnerId");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CircleId")
.IsRequired();
b.Property<string>("MemberId")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<int>("Lag");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ArticleId");
b.Property<long?>("BookQueryId");
b.Property<long?>("CommandId");
b.Property<string>("Comment");
b.Property<int>("Count");
b.Property<long?>("EstimateId");
b.Property<decimal>("UnitaryCost");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.Property<string>("OwnerId");
b.Property<string>("UserId");
b.HasKey("OwnerId", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AttachedFilesString");
b.Property<string>("AttachedGraphicsString");
b.Property<long?>("CommandId");
b.Property<string>("Description");
b.Property<int?>("Status");
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.OAuth2Tokens", b =>
{
b.Property<string>("UserId");
b.Property<string>("AccessToken");
b.Property<DateTime>("Expiration");
b.Property<string>("RefreshToken");
b.Property<string>("TokenType");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.Property<string>("PerfomerId");
b.Property<bool>("AcceptGeoLocalisation");
b.Property<bool>("AcceptNotifications");
b.Property<bool>("AcceptPublicContact");
b.Property<bool>("Active");
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<int>("DailyCost");
b.Property<long>("OrganisationAddressId");
b.Property<int>("Rate");
b.Property<string>("SIRET")
.IsRequired()
.HasAnnotation("MaxLength", 14);
b.Property<string>("WebSite");
b.HasKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ContextId");
b.Property<decimal>("Depth");
b.Property<string>("Description");
b.Property<decimal>("Height");
b.Property<string>("Name");
b.Property<decimal>("Weight");
b.Property<decimal>("Width");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithOne()
.HasForeignKey("YavscWeb.Models.AccountBalance", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("PostalAddressId");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.HasOne("YavscWeb.Models.AccountBalance")
.WithMany()
.HasForeignKey("BalanceId");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("AuthorId");
});
modelBuilder.Entity("YavscWeb.Models.Book.BookQuery", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.HasOne("YavscWeb.Models.Circle")
.WithMany()
.HasForeignKey("CircleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("MemberId");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.HasOne("YavscWeb.Models.BaseProduct")
.WithMany()
.HasForeignKey("ArticleId");
b.HasOne("YavscWeb.Models.Book.BookQuery")
.WithMany()
.HasForeignKey("BookQueryId");
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
b.HasOne("YavscWeb.Models.Estimate")
.WithMany()
.HasForeignKey("EstimateId");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("OrganisationAddressId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ContextId");
});
}
}
}

@ -0,0 +1,372 @@
using System;
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class booking : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_PerformerProfile_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_CommandLine_Query_QueryId", table: "CommandLine");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "QueryId", table: "CommandLine");
migrationBuilder.DropTable("Query");
migrationBuilder.CreateTable(
name: "BookQuery",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
ClientId = table.Column<string>(nullable: false),
EventDate = table.Column<DateTime>(nullable: false),
Lag = table.Column<int>(nullable: false),
LocationId = table.Column<long>(nullable: false),
PerformerId = table.Column<string>(nullable: false),
Previsional = table.Column<decimal>(nullable: true),
ValidationDate = table.Column<DateTime>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_BookQuery", x => x.Id);
table.ForeignKey(
name: "FK_BookQuery_ApplicationUser_ClientId",
column: x => x.ClientId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_BookQuery_Location_LocationId",
column: x => x.LocationId,
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_BookQuery_PerformerProfile_PerformerId",
column: x => x.PerformerId,
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.AddColumn<long>(
name: "BookQueryId",
table: "CommandLine",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_PerformerProfile_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CommandLine_BookQuery_BookQueryId",
table: "CommandLine",
column: "BookQueryId",
principalTable: "BookQuery",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganisationAddressId",
table: "PerformerProfile",
column: "OrganisationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_PerformerProfile_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_CommandLine_BookQuery_BookQueryId", table: "CommandLine");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "BookQueryId", table: "CommandLine");
migrationBuilder.DropTable("BookQuery");
migrationBuilder.CreateTable(
name: "Query",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
ClientId = table.Column<string>(nullable: false),
EventDate = table.Column<DateTime>(nullable: false),
Lag = table.Column<int>(nullable: false),
LocationId = table.Column<long>(nullable: false),
PerformerId = table.Column<string>(nullable: false),
Previsional = table.Column<decimal>(nullable: true),
ValidationDate = table.Column<DateTime>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Query", x => x.Id);
table.ForeignKey(
name: "FK_Query_ApplicationUser_ClientId",
column: x => x.ClientId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Query_Location_LocationId",
column: x => x.LocationId,
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Query_PerformerProfile_PerformerId",
column: x => x.PerformerId,
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.AddColumn<long>(
name: "QueryId",
table: "CommandLine",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_PerformerProfile_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CommandLine_Query_QueryId",
table: "CommandLine",
column: "QueryId",
principalTable: "Query",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganisationAddressId",
table: "PerformerProfile",
column: "OrganisationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

@ -0,0 +1,613 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models;
namespace Yavsc.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20160407112403_dailycost")]
partial class dailycost
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "7.0.0-rc1-16348");
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasAnnotation("Relational:Name", "RoleNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasAnnotation("Relational:TableName", "AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
});
modelBuilder.Entity("YavscWeb.Location", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address")
.IsRequired();
b.Property<double>("Latitude");
b.Property<double>("Longitude");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.Property<string>("UserId");
b.Property<long>("ContactCredits");
b.Property<decimal>("Credits");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.Activity", b =>
{
b.Property<string>("Code")
.HasAnnotation("MaxLength", 512);
b.Property<string>("Description");
b.Property<string>("Name")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<string>("Photo");
b.HasKey("Code");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("DedicatedGoogleCalendar");
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<string>("GoogleRegId");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<long?>("PostalAddressId");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasAnnotation("Relational:Name", "EmailIndex");
b.HasIndex("NormalizedUserName")
.HasAnnotation("Relational:Name", "UserNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetUsers");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BalanceId")
.IsRequired();
b.Property<DateTime>("ExecDate");
b.Property<decimal>("Impact");
b.Property<string>("Reason")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.BaseProduct", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("Name");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AuthorId")
.IsRequired();
b.Property<string>("bcontent");
b.Property<DateTime>("modified");
b.Property<string>("photo");
b.Property<DateTime>("posted");
b.Property<int>("rate");
b.Property<string>("title");
b.Property<bool>("visible");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Book.BookQuery", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("EventDate");
b.Property<int>("Lag");
b.Property<long>("LocationId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<string>("OwnerId");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CircleId")
.IsRequired();
b.Property<string>("MemberId")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<int>("Lag");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ArticleId");
b.Property<long?>("BookQueryId");
b.Property<long?>("CommandId");
b.Property<string>("Comment");
b.Property<int>("Count");
b.Property<long?>("EstimateId");
b.Property<decimal>("UnitaryCost");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.Property<string>("OwnerId");
b.Property<string>("UserId");
b.HasKey("OwnerId", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AttachedFilesString");
b.Property<string>("AttachedGraphicsString");
b.Property<long?>("CommandId");
b.Property<string>("Description");
b.Property<int?>("Status");
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.OAuth2Tokens", b =>
{
b.Property<string>("UserId");
b.Property<string>("AccessToken");
b.Property<DateTime>("Expiration");
b.Property<string>("RefreshToken");
b.Property<string>("TokenType");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.Property<string>("PerfomerId");
b.Property<bool>("AcceptGeoLocalisation");
b.Property<bool>("AcceptNotifications");
b.Property<bool>("AcceptPublicContact");
b.Property<bool>("Active");
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<int?>("MaxDailyCost");
b.Property<int?>("MinDailyCost");
b.Property<long>("OrganisationAddressId");
b.Property<int>("Rate");
b.Property<string>("SIRET")
.IsRequired()
.HasAnnotation("MaxLength", 14);
b.Property<string>("WebSite");
b.HasKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ContextId");
b.Property<decimal>("Depth");
b.Property<string>("Description");
b.Property<decimal>("Height");
b.Property<string>("Name");
b.Property<decimal>("Weight");
b.Property<decimal>("Width");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithOne()
.HasForeignKey("YavscWeb.Models.AccountBalance", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("PostalAddressId");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.HasOne("YavscWeb.Models.AccountBalance")
.WithMany()
.HasForeignKey("BalanceId");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("AuthorId");
});
modelBuilder.Entity("YavscWeb.Models.Book.BookQuery", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.HasOne("YavscWeb.Models.Circle")
.WithMany()
.HasForeignKey("CircleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("MemberId");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.HasOne("YavscWeb.Models.BaseProduct")
.WithMany()
.HasForeignKey("ArticleId");
b.HasOne("YavscWeb.Models.Book.BookQuery")
.WithMany()
.HasForeignKey("BookQueryId");
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
b.HasOne("YavscWeb.Models.Estimate")
.WithMany()
.HasForeignKey("EstimateId");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("OrganisationAddressId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ContextId");
});
}
}
}

@ -0,0 +1,335 @@
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class dailycost : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_ApplicationUser_ClientId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_Location_LocationId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_PerformerProfile_PerformerId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_PerformerProfile_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "DailyCost", table: "PerformerProfile");
migrationBuilder.AddColumn<int>(
name: "MaxDailyCost",
table: "PerformerProfile",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "MinDailyCost",
table: "PerformerProfile",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_ApplicationUser_ClientId",
table: "BookQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_Location_LocationId",
table: "BookQuery",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_PerformerProfile_PerformerId",
table: "BookQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_PerformerProfile_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganisationAddressId",
table: "PerformerProfile",
column: "OrganisationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_ApplicationUser_ClientId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_Location_LocationId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_PerformerProfile_PerformerId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_PerformerProfile_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "MaxDailyCost", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "MinDailyCost", table: "PerformerProfile");
migrationBuilder.AddColumn<int>(
name: "DailyCost",
table: "PerformerProfile",
nullable: false,
defaultValue: 0);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_ApplicationUser_ClientId",
table: "BookQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_Location_LocationId",
table: "BookQuery",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_PerformerProfile_PerformerId",
table: "BookQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_PerformerProfile_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganisationAddressId",
table: "PerformerProfile",
column: "OrganisationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

@ -0,0 +1,619 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models;
namespace Yavsc.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20160418114001_commandCreation")]
partial class commandCreation
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "7.0.0-rc1-16348");
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasAnnotation("Relational:Name", "RoleNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasAnnotation("Relational:TableName", "AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
});
modelBuilder.Entity("YavscWeb.Location", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address")
.IsRequired();
b.Property<double>("Latitude");
b.Property<double>("Longitude");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.Property<string>("UserId");
b.Property<long>("ContactCredits");
b.Property<decimal>("Credits");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.Activity", b =>
{
b.Property<string>("Code")
.HasAnnotation("MaxLength", 512);
b.Property<string>("Description");
b.Property<string>("Name")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<string>("Photo");
b.HasKey("Code");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("DedicatedGoogleCalendar");
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<string>("GoogleRegId");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<long?>("PostalAddressId");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasAnnotation("Relational:Name", "EmailIndex");
b.HasIndex("NormalizedUserName")
.HasAnnotation("Relational:Name", "UserNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetUsers");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BalanceId")
.IsRequired();
b.Property<DateTime>("ExecDate");
b.Property<decimal>("Impact");
b.Property<string>("Reason")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.BaseProduct", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("Name");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AuthorId")
.IsRequired();
b.Property<string>("bcontent");
b.Property<DateTime>("modified");
b.Property<string>("photo");
b.Property<DateTime>("posted");
b.Property<int>("rate");
b.Property<string>("title");
b.Property<bool>("visible");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Booking.BookQuery", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("CreationDate")
.ValueGeneratedOnAdd()
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
b.Property<DateTime>("EventDate");
b.Property<int>("Lag");
b.Property<long>("LocationId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<string>("OwnerId");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CircleId")
.IsRequired();
b.Property<string>("MemberId")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("CreationDate");
b.Property<int>("Lag");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ArticleId");
b.Property<long?>("BookQueryId");
b.Property<long?>("CommandId");
b.Property<string>("Comment");
b.Property<int>("Count");
b.Property<long?>("EstimateId");
b.Property<decimal>("UnitaryCost");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.Property<string>("OwnerId");
b.Property<string>("UserId");
b.HasKey("OwnerId", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AttachedFilesString");
b.Property<string>("AttachedGraphicsString");
b.Property<long?>("CommandId");
b.Property<string>("Description");
b.Property<int?>("Status");
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.OAuth2Tokens", b =>
{
b.Property<string>("UserId");
b.Property<string>("AccessToken");
b.Property<DateTime>("Expiration");
b.Property<string>("RefreshToken");
b.Property<string>("TokenType");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.Property<string>("PerfomerId");
b.Property<bool>("AcceptGeoLocalisation");
b.Property<bool>("AcceptNotifications");
b.Property<bool>("AcceptPublicContact");
b.Property<bool>("Active");
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<int?>("MaxDailyCost");
b.Property<int?>("MinDailyCost");
b.Property<long>("OrganisationAddressId");
b.Property<int>("Rate");
b.Property<string>("SIRET")
.IsRequired()
.HasAnnotation("MaxLength", 14);
b.Property<string>("WebSite");
b.HasKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ContextId");
b.Property<decimal>("Depth");
b.Property<string>("Description");
b.Property<decimal>("Height");
b.Property<string>("Name");
b.Property<decimal>("Weight");
b.Property<decimal>("Width");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithOne()
.HasForeignKey("YavscWeb.Models.AccountBalance", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("PostalAddressId");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.HasOne("YavscWeb.Models.AccountBalance")
.WithMany()
.HasForeignKey("BalanceId");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("AuthorId");
});
modelBuilder.Entity("YavscWeb.Models.Booking.BookQuery", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.HasOne("YavscWeb.Models.Circle")
.WithMany()
.HasForeignKey("CircleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("MemberId");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.HasOne("YavscWeb.Models.BaseProduct")
.WithMany()
.HasForeignKey("ArticleId");
b.HasOne("YavscWeb.Models.Booking.BookQuery")
.WithMany()
.HasForeignKey("BookQueryId");
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
b.HasOne("YavscWeb.Models.Estimate")
.WithMany()
.HasForeignKey("EstimateId");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("OrganisationAddressId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ContextId");
});
}
}
}

@ -0,0 +1,332 @@
using System;
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class commandCreation : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_ApplicationUser_ClientId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_Location_LocationId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_PerformerProfile_PerformerId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_PerformerProfile_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.AddColumn<DateTime>(
name: "CreationDate",
table: "Command",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<DateTime>(
name: "CreationDate",
table: "BookQuery",
nullable: false,
defaultValueSql: "LOCALTIMESTAMP");
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_ApplicationUser_ClientId",
table: "BookQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_Location_LocationId",
table: "BookQuery",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_PerformerProfile_PerformerId",
table: "BookQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_PerformerProfile_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganisationAddressId",
table: "PerformerProfile",
column: "OrganisationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_ApplicationUser_ClientId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_Location_LocationId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_PerformerProfile_PerformerId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_PerformerProfile_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "CreationDate", table: "Command");
migrationBuilder.DropColumn(name: "CreationDate", table: "BookQuery");
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_ApplicationUser_ClientId",
table: "BookQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_Location_LocationId",
table: "BookQuery",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_PerformerProfile_PerformerId",
table: "BookQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_PerformerProfile_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganisationAddressId",
table: "PerformerProfile",
column: "OrganisationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

@ -0,0 +1,619 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models;
namespace Yavsc.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20160427123737_perfoffer")]
partial class perfoffer
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "7.0.0-rc1-16348");
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasAnnotation("Relational:Name", "RoleNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasAnnotation("Relational:TableName", "AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
});
modelBuilder.Entity("YavscWeb.Location", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address")
.IsRequired();
b.Property<double>("Latitude");
b.Property<double>("Longitude");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.Property<string>("UserId");
b.Property<long>("ContactCredits");
b.Property<decimal>("Credits");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.Activity", b =>
{
b.Property<string>("Code")
.HasAnnotation("MaxLength", 512);
b.Property<string>("ActorDenomination");
b.Property<string>("Description");
b.Property<string>("Name")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<string>("Photo");
b.HasKey("Code");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("DedicatedGoogleCalendar");
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<string>("GoogleRegId");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<long?>("PostalAddressId");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasAnnotation("Relational:Name", "EmailIndex");
b.HasIndex("NormalizedUserName")
.HasAnnotation("Relational:Name", "UserNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetUsers");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BalanceId")
.IsRequired();
b.Property<DateTime>("ExecDate");
b.Property<decimal>("Impact");
b.Property<string>("Reason")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.BaseProduct", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("Name");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AuthorId")
.IsRequired();
b.Property<string>("bcontent");
b.Property<DateTime>("modified");
b.Property<string>("photo");
b.Property<DateTime>("posted");
b.Property<int>("rate");
b.Property<string>("title");
b.Property<bool>("visible");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Booking.BookQuery", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("CreationDate")
.ValueGeneratedOnAdd()
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
b.Property<DateTime>("EventDate");
b.Property<int>("Lag");
b.Property<long>("LocationId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<string>("OwnerId");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CircleId")
.IsRequired();
b.Property<string>("MemberId")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("CreationDate");
b.Property<int>("Lag");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ArticleId");
b.Property<long?>("BookQueryId");
b.Property<long?>("CommandId");
b.Property<string>("Comment");
b.Property<int>("Count");
b.Property<long?>("EstimateId");
b.Property<decimal>("UnitaryCost");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.Property<string>("OwnerId");
b.Property<string>("UserId");
b.HasKey("OwnerId", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AttachedFilesString");
b.Property<string>("AttachedGraphicsString");
b.Property<long?>("CommandId");
b.Property<string>("Description");
b.Property<int?>("Status");
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.OAuth2Tokens", b =>
{
b.Property<string>("UserId");
b.Property<string>("AccessToken");
b.Property<DateTime>("Expiration");
b.Property<string>("RefreshToken");
b.Property<string>("TokenType");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.Property<string>("PerfomerId");
b.Property<bool>("AcceptGeoLocalisation");
b.Property<bool>("AcceptNotifications");
b.Property<bool>("AcceptPublicContact");
b.Property<bool>("Active");
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<int?>("MaxDailyCost");
b.Property<int?>("MinDailyCost");
b.Property<long?>("OfferId");
b.Property<long>("OrganisationAddressId");
b.Property<int>("Rate");
b.Property<string>("SIRET")
.IsRequired()
.HasAnnotation("MaxLength", 14);
b.Property<string>("WebSite");
b.HasKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ContextId");
b.Property<string>("Description");
b.Property<string>("Name");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithOne()
.HasForeignKey("YavscWeb.Models.AccountBalance", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("PostalAddressId");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.HasOne("YavscWeb.Models.AccountBalance")
.WithMany()
.HasForeignKey("BalanceId");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("AuthorId");
});
modelBuilder.Entity("YavscWeb.Models.Booking.BookQuery", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.HasOne("YavscWeb.Models.Circle")
.WithMany()
.HasForeignKey("CircleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("MemberId");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.HasOne("YavscWeb.Models.BaseProduct")
.WithMany()
.HasForeignKey("ArticleId");
b.HasOne("YavscWeb.Models.Booking.BookQuery")
.WithMany()
.HasForeignKey("BookQueryId");
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
b.HasOne("YavscWeb.Models.Estimate")
.WithMany()
.HasForeignKey("EstimateId");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("YavscWeb.Models.Service")
.WithMany()
.HasForeignKey("OfferId");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("OrganisationAddressId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ContextId");
});
}
}
}

@ -0,0 +1,361 @@
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class perfoffer : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_ApplicationUser_ClientId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_Location_LocationId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_PerformerProfile_PerformerId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_PerformerProfile_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "Depth", table: "Service");
migrationBuilder.DropColumn(name: "Height", table: "Service");
migrationBuilder.DropColumn(name: "Weight", table: "Service");
migrationBuilder.DropColumn(name: "Width", table: "Service");
migrationBuilder.AddColumn<long>(
name: "OfferId",
table: "PerformerProfile",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "ActorDenomination",
table: "Activity",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_ApplicationUser_ClientId",
table: "BookQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_Location_LocationId",
table: "BookQuery",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_PerformerProfile_PerformerId",
table: "BookQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_PerformerProfile_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Service_OfferId",
table: "PerformerProfile",
column: "OfferId",
principalTable: "Service",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganisationAddressId",
table: "PerformerProfile",
column: "OrganisationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_ApplicationUser_ClientId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_Location_LocationId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_PerformerProfile_PerformerId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_PerformerProfile_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Service_OfferId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "OfferId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "ActorDenomination", table: "Activity");
migrationBuilder.AddColumn<decimal>(
name: "Depth",
table: "Service",
nullable: false,
defaultValue: 0m);
migrationBuilder.AddColumn<decimal>(
name: "Height",
table: "Service",
nullable: false,
defaultValue: 0m);
migrationBuilder.AddColumn<decimal>(
name: "Weight",
table: "Service",
nullable: false,
defaultValue: 0m);
migrationBuilder.AddColumn<decimal>(
name: "Width",
table: "Service",
nullable: false,
defaultValue: 0m);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_ApplicationUser_ClientId",
table: "BookQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_Location_LocationId",
table: "BookQuery",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_PerformerProfile_PerformerId",
table: "BookQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_PerformerProfile_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganisationAddressId",
table: "PerformerProfile",
column: "OrganisationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

@ -0,0 +1,623 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models;
namespace Yavsc.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20160506154628_siren")]
partial class siren
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "7.0.0-rc1-16348");
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasAnnotation("Relational:Name", "RoleNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasAnnotation("Relational:TableName", "AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
});
modelBuilder.Entity("YavscWeb.Location", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address")
.IsRequired();
b.Property<double>("Latitude");
b.Property<double>("Longitude");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.Property<string>("UserId");
b.Property<long>("ContactCredits");
b.Property<decimal>("Credits");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.Activity", b =>
{
b.Property<string>("Code")
.HasAnnotation("MaxLength", 512);
b.Property<string>("ActorDenomination");
b.Property<string>("Description");
b.Property<string>("Name")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<string>("Photo");
b.HasKey("Code");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("DedicatedGoogleCalendar");
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<string>("GoogleRegId");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<long?>("PostalAddressId");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasAnnotation("Relational:Name", "EmailIndex");
b.HasIndex("NormalizedUserName")
.HasAnnotation("Relational:Name", "UserNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetUsers");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BalanceId")
.IsRequired();
b.Property<DateTime>("ExecDate");
b.Property<decimal>("Impact");
b.Property<string>("Reason")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.BaseProduct", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("Name");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AuthorId")
.IsRequired();
b.Property<string>("bcontent");
b.Property<DateTime>("modified");
b.Property<string>("photo");
b.Property<DateTime>("posted");
b.Property<int>("rate");
b.Property<string>("title");
b.Property<bool>("visible");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Booking.BookQuery", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("CreationDate")
.ValueGeneratedOnAdd()
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
b.Property<DateTime>("EventDate");
b.Property<int>("Lag");
b.Property<long>("LocationId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<string>("OwnerId");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CircleId")
.IsRequired();
b.Property<string>("MemberId")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("CreationDate");
b.Property<int>("Lag");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ArticleId");
b.Property<long?>("BookQueryId");
b.Property<long?>("CommandId");
b.Property<string>("Comment");
b.Property<int>("Count");
b.Property<long?>("EstimateId");
b.Property<decimal>("UnitaryCost");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.Property<string>("OwnerId");
b.Property<string>("UserId");
b.HasKey("OwnerId", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AttachedFilesString");
b.Property<string>("AttachedGraphicsString");
b.Property<long?>("CommandId");
b.Property<string>("Description");
b.Property<int?>("Status");
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.OAuth2Tokens", b =>
{
b.Property<string>("UserId");
b.Property<string>("AccessToken");
b.Property<DateTime>("Expiration");
b.Property<string>("RefreshToken");
b.Property<string>("TokenType");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.Property<string>("PerfomerId");
b.Property<bool>("AcceptGeoLocalisation");
b.Property<bool>("AcceptNotifications");
b.Property<bool>("AcceptPublicContact");
b.Property<bool>("Active");
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<int?>("MaxDailyCost");
b.Property<int?>("MinDailyCost");
b.Property<long?>("OfferId");
b.Property<long>("OrganisationAddressId");
b.Property<int>("Rate");
b.Property<string>("SIREN")
.IsRequired()
.HasAnnotation("MaxLength", 14);
b.Property<string>("WebSite");
b.HasKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("Billing");
b.Property<string>("ContextId");
b.Property<string>("Description");
b.Property<string>("Name");
b.Property<decimal?>("Pricing");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithOne()
.HasForeignKey("YavscWeb.Models.AccountBalance", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("PostalAddressId");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.HasOne("YavscWeb.Models.AccountBalance")
.WithMany()
.HasForeignKey("BalanceId");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("AuthorId");
});
modelBuilder.Entity("YavscWeb.Models.Booking.BookQuery", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.HasOne("YavscWeb.Models.Circle")
.WithMany()
.HasForeignKey("CircleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("MemberId");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.HasOne("YavscWeb.Models.BaseProduct")
.WithMany()
.HasForeignKey("ArticleId");
b.HasOne("YavscWeb.Models.Booking.BookQuery")
.WithMany()
.HasForeignKey("BookQueryId");
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
b.HasOne("YavscWeb.Models.Estimate")
.WithMany()
.HasForeignKey("EstimateId");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("YavscWeb.Models.Service")
.WithMany()
.HasForeignKey("OfferId");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("OrganisationAddressId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ContextId");
});
}
}
}

@ -0,0 +1,341 @@
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class siren : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_ApplicationUser_ClientId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_Location_LocationId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_PerformerProfile_PerformerId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_PerformerProfile_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "SIRET", table: "PerformerProfile");
migrationBuilder.AddColumn<int>(
name: "Billing",
table: "Service",
nullable: true);
migrationBuilder.AddColumn<decimal>(
name: "Pricing",
table: "Service",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "SIREN",
table: "PerformerProfile",
nullable: false,
defaultValue: "");
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_ApplicationUser_ClientId",
table: "BookQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_Location_LocationId",
table: "BookQuery",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_PerformerProfile_PerformerId",
table: "BookQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_PerformerProfile_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganisationAddressId",
table: "PerformerProfile",
column: "OrganisationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_ApplicationUser_ClientId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_Location_LocationId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_PerformerProfile_PerformerId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Command_ApplicationUser_ClientId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Command_PerformerProfile_PerformerId", table: "Command");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "Billing", table: "Service");
migrationBuilder.DropColumn(name: "Pricing", table: "Service");
migrationBuilder.DropColumn(name: "SIREN", table: "PerformerProfile");
migrationBuilder.AddColumn<string>(
name: "SIRET",
table: "PerformerProfile",
nullable: false,
defaultValue: "");
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Blog_ApplicationUser_AuthorId",
table: "Blog",
column: "AuthorId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_ApplicationUser_ClientId",
table: "BookQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_Location_LocationId",
table: "BookQuery",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_PerformerProfile_PerformerId",
table: "BookQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_ApplicationUser_ClientId",
table: "Command",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Command_PerformerProfile_PerformerId",
table: "Command",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerfomerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganisationAddressId",
table: "PerformerProfile",
column: "OrganisationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerfomerId",
table: "PerformerProfile",
column: "PerfomerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

@ -0,0 +1,644 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models;
namespace Yavsc.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20160515142434_tokenExpiresIn")]
partial class tokenExpiresIn
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "7.0.0-rc1-16348");
modelBuilder.Entity("Application", b =>
{
b.Property<string>("ApplicationID");
b.Property<string>("DisplayName");
b.Property<string>("LogoutRedirectUri");
b.Property<string>("RedirectUri");
b.Property<string>("Secret");
b.HasKey("ApplicationID");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasAnnotation("Relational:Name", "RoleNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasAnnotation("Relational:TableName", "AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
});
modelBuilder.Entity("YavscWeb.Location", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address")
.IsRequired();
b.Property<double>("Latitude");
b.Property<double>("Longitude");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.Property<string>("UserId");
b.Property<long>("ContactCredits");
b.Property<decimal>("Credits");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.Activity", b =>
{
b.Property<string>("Code")
.HasAnnotation("MaxLength", 512);
b.Property<string>("ActorDenomination");
b.Property<string>("Description");
b.Property<string>("Name")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<string>("Photo");
b.HasKey("Code");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("DedicatedGoogleCalendar");
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<string>("GoogleRegId");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<long?>("PostalAddressId");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasAnnotation("Relational:Name", "EmailIndex");
b.HasIndex("NormalizedUserName")
.HasAnnotation("Relational:Name", "UserNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetUsers");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BalanceId")
.IsRequired();
b.Property<DateTime>("ExecDate");
b.Property<decimal>("Impact");
b.Property<string>("Reason")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.BaseProduct", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("Name");
b.Property<bool>("Public");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AuthorId")
.IsRequired();
b.Property<string>("bcontent");
b.Property<DateTime>("modified");
b.Property<string>("photo");
b.Property<DateTime>("posted");
b.Property<int>("rate");
b.Property<string>("title");
b.Property<bool>("visible");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Booking.BookQuery", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("CreationDate")
.ValueGeneratedOnAdd()
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
b.Property<DateTime>("EventDate");
b.Property<int>("Lag");
b.Property<long>("LocationId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<string>("OwnerId");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CircleId")
.IsRequired();
b.Property<string>("MemberId")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("CreationDate");
b.Property<int>("Lag");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ArticleId");
b.Property<long?>("BookQueryId");
b.Property<long?>("CommandId");
b.Property<string>("Comment");
b.Property<int>("Count");
b.Property<long?>("EstimateId");
b.Property<decimal>("UnitaryCost");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.Property<string>("OwnerId");
b.Property<string>("UserId");
b.HasKey("OwnerId", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AttachedFilesString");
b.Property<string>("AttachedGraphicsString");
b.Property<long?>("CommandId");
b.Property<string>("Description");
b.Property<int?>("Status");
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.OAuth2Tokens", b =>
{
b.Property<string>("UserId");
b.Property<string>("AccessToken");
b.Property<DateTime>("Expiration");
b.Property<string>("ExpiresIn");
b.Property<string>("RefreshToken");
b.Property<string>("TokenType");
b.HasKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.Property<string>("PerfomerId");
b.Property<bool>("AcceptGeoLocalisation");
b.Property<bool>("AcceptNotifications");
b.Property<bool>("AcceptPublicContact");
b.Property<bool>("Active");
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<int?>("MaxDailyCost");
b.Property<int?>("MinDailyCost");
b.Property<long?>("OfferId");
b.Property<long>("OrganisationAddressId");
b.Property<int>("Rate");
b.Property<string>("SIREN")
.IsRequired()
.HasAnnotation("MaxLength", 14);
b.Property<string>("WebSite");
b.HasKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("Billing");
b.Property<string>("ContextId");
b.Property<string>("Description");
b.Property<string>("Name");
b.Property<decimal?>("Pricing");
b.Property<bool>("Public");
b.HasKey("Id");
});
modelBuilder.Entity("YavscWeb.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("YavscWeb.Models.AccountBalance", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithOne()
.HasForeignKey("YavscWeb.Models.AccountBalance", "UserId");
});
modelBuilder.Entity("YavscWeb.Models.ApplicationUser", b =>
{
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("PostalAddressId");
});
modelBuilder.Entity("YavscWeb.Models.BalanceImpact", b =>
{
b.HasOne("YavscWeb.Models.AccountBalance")
.WithMany()
.HasForeignKey("BalanceId");
});
modelBuilder.Entity("YavscWeb.Models.Blog", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("AuthorId");
});
modelBuilder.Entity("YavscWeb.Models.Booking.BookQuery", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.Circle", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("YavscWeb.Models.CircleMember", b =>
{
b.HasOne("YavscWeb.Models.Circle")
.WithMany()
.HasForeignKey("CircleId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("MemberId");
});
modelBuilder.Entity("YavscWeb.Models.Command", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("YavscWeb.Models.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("YavscWeb.Models.CommandLine", b =>
{
b.HasOne("YavscWeb.Models.BaseProduct")
.WithMany()
.HasForeignKey("ArticleId");
b.HasOne("YavscWeb.Models.Booking.BookQuery")
.WithMany()
.HasForeignKey("BookQueryId");
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
b.HasOne("YavscWeb.Models.Estimate")
.WithMany()
.HasForeignKey("EstimateId");
});
modelBuilder.Entity("YavscWeb.Models.Contact", b =>
{
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("YavscWeb.Models.Estimate", b =>
{
b.HasOne("YavscWeb.Models.Command")
.WithMany()
.HasForeignKey("CommandId");
});
modelBuilder.Entity("YavscWeb.Models.PerformerProfile", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("YavscWeb.Models.Service")
.WithMany()
.HasForeignKey("OfferId");
b.HasOne("YavscWeb.Location")
.WithMany()
.HasForeignKey("OrganisationAddressId");
b.HasOne("YavscWeb.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerfomerId");
});
modelBuilder.Entity("YavscWeb.Models.Service", b =>
{
b.HasOne("YavscWeb.Models.Activity")
.WithMany()
.HasForeignKey("ContextId");
});
}
}
}

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

Loading…