Initial import

This commit is contained in:
Paul Schneider 2014-07-16 20:35:03 +02:00
commit 04804b89a9
279 changed files with 12945 additions and 0 deletions

View file

@ -0,0 +1,84 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace yavscModel.Admin
{
public class DataAccess {
private string host = "localhost";
[StringLength(2056)]
public string Host {
get {
return host;
}
set {
host = value;
}
}
private int port = 5432;
public int Port {
get {
return port;
}
set {
port = value;
}
}
private string dbname = "yavsc";
public string Dbname {
get {
return dbname;
}
set {
dbname = value;
}
}
private string dbuser = "postgres";
public string Dbuser {
get {
return dbuser;
}
set {
dbuser = value;
}
}
private string dbpassword ;
private string backupPrefix= "backup/global.backup";
public string BackupPrefix {
get {
return backupPrefix;
}
set {
backupPrefix = value;
}
}
[Required(ErrorMessage ="Please, specify a password")]
public string Password {
get { return dbpassword; }
set { dbpassword = value; }
}
public string [] GetBackupDirs()
{
List<string> res = new List<string> ();
string bkpdir = new FileInfo (backupPrefix).DirectoryName;
DirectoryInfo bkpdiri = new DirectoryInfo(bkpdir);
foreach (DirectoryInfo di in bkpdiri.EnumerateDirectories())
res.Add (Path.Combine(bkpdir,di.Name));
return res.ToArray ();
}
}
}

View file

@ -0,0 +1,17 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace yavscModel.Admin
{
public class RestoreQuery: DataAccess
{
[Required]
[StringLength(2056)]
public string FileName { get; set ; }
public RestoreQuery ()
{
}
}
}

View file

@ -0,0 +1,26 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using Npgsql.Web.Blog.DataModel;
namespace yavscModel
{
public class BlogEditCommentModel:Comment
{
[DisplayName("Prévisualiser")]
[Required]
public bool Preview { get; set; }
/* TODO Clean
public BlogEditCommentModel(Comment be) {
this.Preview = true;
this.Content = be.Content;
this.Posted = be.Posted;
this.Modified = be.Modified;
this.Visible = be.Visible;
this.From = be.From;
this.PostId = be.PostId;
this.Id = be.Id;
} */
}
}

View file

@ -0,0 +1,29 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using Npgsql.Web.Blog.DataModel;
namespace yavscModel
{
public class BlogEditEntryModel:BlogEntry
{
[DisplayName("Prévisualiser")]
[Required]
public bool Preview { get; set; }
public BlogEditEntryModel ()
{
}
public BlogEditEntryModel(BlogEntry be) {
this.Preview = true;
this.Content = be.Content;
this.Title = be.Title;
this.Posted = be.Posted;
this.Modified = be.Modified;
this.Visible = be.Visible;
this.UserName = be.UserName;
this.Id = be.Id;
}
}
}

View file

@ -0,0 +1,12 @@
using System;
using System.IO;
using System.Collections.Generic;
namespace FileSystem
{
public class FileInfoCollection: List<FileInfo>
{
}
}

View file

@ -0,0 +1,22 @@
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 ("YavscModel")]
[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("")]

View file

@ -0,0 +1,22 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace yavscModel.RolesAndMembers
{
public class ChangePasswordModel
{
[Required(ErrorMessage = "Please enter a Username")]
public string Username { get; set; }
[Required(ErrorMessage = "Please your old Password")]
public string OldPassword { get; set; }
[Required(ErrorMessage = "Please enter a new Password")]
public string NewPassword { get; set; }
[Required(ErrorMessage = "Please confirm the new Password")]
public string ConfirmPassword { get; set; }
}
}

View file

@ -0,0 +1,22 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
namespace yavscModel.RolesAndMembers
{
public class LoginModel
{
[DisplayName("Nom d'utilisateur")]
[Required(ErrorMessage = "S'il vous plait, entrez un nom d'utilisateur ([a-z]|[A-Z]|[-_.~])+")]
[RegularExpression("([a-z]|[A-Z]|[-_.~])+")]
public string UserName { get; set; }
[DisplayName("Mot de passe")]
[Required(ErrorMessage = "S'il vous plait, entez un mot de passe")]
[RegularExpression("([a-z]|[A-Z]|[-_.~#{}`'\\^])+")]
public string Password { get; set; }
[Display(Name = "Se souvenir du mot de passe")]
public bool RememberMe { get; set; }
}
}

View file

@ -0,0 +1,13 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace yavscModel.RolesAndMembers
{
public class NewAdminModel
{
[Required(ErrorMessage = "S'il vous plait, entrez un nom d'utilisateur")]
[Display(Name = "Nom du nouvel administrateur", Description="Nom de l'utilisateur à enregistrer comme administrateur")]
public string UserName { get; set ; }
}
}

View file

@ -0,0 +1,15 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
namespace yavscModel.RolesAndMembers
{
public class NewRoleModel
{
[Required]
[StringLength(255)]
[DisplayName("Nom du rôle")]
public string RoleName { get; set; }
}
}

View file

@ -0,0 +1,63 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Web.Profile;
namespace yavscModel.RolesAndMembers
{
public class Profile
{
[DisplayName("Adresse")]
[StringLength(2047)]
public string Address { get; set; }
[DisplayName("Ville")]
[StringLength(255)]
public string CityAndState { get; set; }
[DisplayName("Code Postal")]
[StringLength(9)]
public string ZipCode { get; set; }
[DisplayName("Pays")]
[StringLength(99)]
public string Country { get; set; }
[DisplayName("Site Web")]
[StringLength(255)]
public string WebSite { get; set; }
[DisplayName("Blog visible")]
public bool BlogVisible { get; set; }
[DisplayName("Titre du blog")]
public string BlogTitle { get; set; }
public void FromProfileBase(ProfileBase profile)
{
object b = profile.GetPropertyValue ("BlogVisible");
BlogVisible = (b is DBNull) ? true : (bool)b;
object s = profile.GetPropertyValue ("BlogTitle");
BlogTitle = (s is DBNull) ? null : (string)s;
s = profile.GetPropertyValue("Address");
Address = (s is DBNull)?null:(string)s;
s = profile.GetPropertyValue("CityAndState");
CityAndState = (s is DBNull)?null:(string)s;
s = profile.GetPropertyValue("Country");
Country = (s is DBNull)?null:(string)s;
s = profile.GetPropertyValue("ZipCode");
ZipCode = (s is DBNull)?null:(string)s;
s = profile.GetPropertyValue ("WebSite");
WebSite = (s is DBNull) ? null : (string)s;
}
}
}

View file

@ -0,0 +1,25 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace yavscModel.RolesAndMembers
{
public class RegisterViewModel
{
[DisplayName("Nom d'utilisateur")]
[Required(ErrorMessage = "S'il vous plait, entrez un nom d'utilisateur")]
public string UserName { get; set; }
[DisplayName("Mot de passe")]
[Required(ErrorMessage = "S'il vous plait, entez un mot de passe")]
public string Password { get; set; }
[DisplayName("Confirmation du mot de passe")]
public string ConfirmPassword { get; set; }
[DisplayName("Adresse e-mail")]
[Required(ErrorMessage = "S'il vous plait, entrez un e-mail valide")]
public string Email { get; set; }
}
}

View file

@ -0,0 +1,22 @@
using System;
namespace yavscModel.WorkFlow
{
public class Estimate
{
public Estimate ()
{
}
public string Description { get; set; }
public decimal Ciffer {
get {
decimal total = 0;
foreach (Writting l in Lines)
total += l.UnitaryCost * l.Count;
return total;
}
}
public Writting[] Lines { get; set; }
}
}

View file

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
namespace yavscModel.WorkFlow
{
public interface IContent
{
object Data { get; set; }
string MimeType { get; set; }
}
}

View file

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace yavscModel.WorkFlow
{
public interface IContentProvider: IDisposable
{
string Order (IWFCommand c);
IContent Get (string orderId);
}
}

View file

@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
namespace yavscModel.WorkFlow
{
public interface IWFCommand
{
}
}

View file

@ -0,0 +1,13 @@
using System;
using yavscModel.WorkFlow;
using System.Web.Mvc;
namespace WorkFlow
{
public interface IWFModule
{
int GetState (IWFCommand c);
int Handle (IWFCommand c,FormCollection collection);
}
}

View file

@ -0,0 +1,23 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
namespace yavscModel.WorkFlow
{
public class NewProjectModel
{
[DisplayName("Nom du projet")]
[Required()]
public string Name { get; set; }
[DisplayName("Manager du projet")]
[Required]
public string Manager { get; set; }
[DisplayName("Description du projet")]
[Required]
public string Description { get; set; }
}
}

View file

@ -0,0 +1,39 @@
using System;
using SalesCatalog.Model;
using yavscModel.WorkFlow;
namespace WorkFlow
{
public class WFOrder : IWFCommand
{
private Product p;
private DateTime date;
private string catref;
public WFOrder(Product prod,string catalogReference){
date = DateTime.Now;
catref=catalogReference;
p = prod;
}
public override string ToString ()
{
return string.Format ("[Commande date={0} prodref={1}, cat={2}]",date,p.Reference,catref);
}
#region IWFCommand implementation
public string CatalogReference {
get {
return catref;
}
}
public DateTime OrderDate {
get {
return date;
}
}
#endregion
}
}

View file

@ -0,0 +1,13 @@
using System;
namespace yavscModel.WorkFlow
{
public class Writting
{
public decimal UnitaryCost { get; set; }
public int Count { get; set; }
public string ProductReference { get; set; }
public string Description { get; set; }
}
}

View file

@ -0,0 +1,89 @@
<?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>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{68F5B80A-616E-4C3C-91A0-828AA40000BD}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>yavscModel</RootNamespace>
<AssemblyName>yavscModel</AssemblyName>
</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>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="nunit.framework" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RolesAndMemebers\ChangePasswordModel.cs" />
<Compile Include="RolesAndMemebers\LoginModel.cs" />
<Compile Include="RolesAndMemebers\NewAdminModel.cs" />
<Compile Include="RolesAndMemebers\NewRoleModel.cs" />
<Compile Include="RolesAndMemebers\RegisterViewModel.cs" />
<Compile Include="WorkFlow\NewProjectModel.cs" />
<Compile Include="Blogs\BlogEditEntryModel.cs" />
<Compile Include="Admin\RestoreQuery.cs" />
<Compile Include="Admin\DataAccess.cs" />
<Compile Include="RolesAndMemebers\Profile.cs" />
<Compile Include="Blogs\BlogEditCommentModel.cs" />
<Compile Include="FileSystem\FileInfoCollection.cs" />
<Compile Include="WorkFlow\Writting.cs" />
<Compile Include="WorkFlow\Estimate.cs" />
<Compile Include="WorkFlow\WFOrder.cs" />
<Compile Include="WorkFlow\IContent.cs" />
<Compile Include="WorkFlow\IContentProvider.cs" />
<Compile Include="WorkFlow\IWFCommand.cs" />
<Compile Include="WorkFlow\IWFModule.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Folder Include="RolesAndMemebers\" />
<Folder Include="WorkFlow\" />
<Folder Include="Blogs\" />
<Folder Include="Admin\" />
<Folder Include="FileSystem\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NpgsqlBlogProvider\NpgsqlBlogProvider.csproj">
<Project>{C6E9E91B-97D3-48D9-8AA7-05356929E162}</Project>
<Name>NpgsqlBlogProvider</Name>
</ProjectReference>
<ProjectReference Include="..\SalesCatalog\SalesCatalog.csproj">
<Project>{90BF2234-7252-4CD5-B2A4-17501B19279B}</Project>
<Name>SalesCatalog</Name>
</ProjectReference>
</ItemGroup>
<ProjectExtensions>
<MonoDevelop>
<Properties>
<Policies>
<DotNetNamingPolicy DirectoryNamespaceAssociation="Flat" ResourceNamePolicy="FileFormatDefault" />
</Policies>
</Properties>
</MonoDevelop>
</ProjectExtensions>
</Project>