Browse Source

اصلاح روش محاسبه امتیاز

master
Amir Ehsani 10 years ago
parent
commit
b39a4e3905
7 changed files with 773 additions and 332 deletions
  1. +106
    -96
      Sevomin.Models/DovominJob.cs
  2. +29
    -0
      Sevomin.Models/Migrations/201409010546480_basepoint.Designer.cs
  3. +266
    -0
      Sevomin.Models/Migrations/201409010546480_basepoint.cs
  4. +126
    -0
      Sevomin.Models/Migrations/201409010546480_basepoint.resx
  5. +51
    -50
      Sevomin.Models/Parameter.cs
  6. +149
    -140
      Sevomin.Models/Sevomin.Models.csproj
  7. +46
    -46
      Sevomin.Models/SevominDbContext.cs

+ 106
- 96
Sevomin.Models/DovominJob.cs View File

@ -1,96 +1,106 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace Sevomin.Models
{
public class DovominJob
{
[Key]
public long Id { get; set; }
[Index("IX_DovominJobUniqueIndex", Order = 1, IsUnique = true)]
[Required]
[StringLength(128)]
public string DovominId { get; set; }
[Index]
[Index("IX_DovominJobUniqueIndex", Order = 2, IsUnique = true)]
[Required]
public long JobId { get; set; }
[Required]
public DateTime ApplyDate { get; set; }
public string CoverLetter { get; set; }
public decimal Affinity { get; set; }
public bool MinimumRequirement { get; set; }
public DateTime? AvalinSeen { get; set; }
public string AvalinComment { get; set; }
public bool AvalinDelete { get; set; }
public virtual Dovomin Dovomin { get; set; }
public virtual Job Job { get; set; }
public DovominJob(Dovomin dovomin, Job job)
{
this.Dovomin = dovomin;
this.Job = job;
CalculateAffinity();
}
public DovominJob()
{
}
public void CalculateAffinity()
{
if (Dovomin == null || Job == null)
return;
MinimumRequirement = true;
decimal sum = 0;
decimal count = 0;
Affinity = 0;
foreach (var jp in
Job.JobParameters.Where(x=>x.Moscow != 0 && !string.IsNullOrWhiteSpace(x.StringValue) ))
{
count++;
DovominParameter dp = Dovomin.DovominParameters.SingleOrDefault(x=>x.ParameterId == jp.ParameterId);
if (dp == null)
continue;
if (jp.Moscow == 4)
{
if ((jp.StringValue != dp.StringValue && jp.NumericValue == 0)
|| (jp.NumericValue > 0 && jp.NumericValue > dp.NumericValue))
{
MinimumRequirement = false;
}
}
decimal? dpv = dp.NumericValue;
decimal? jpv = jp.NumericValue;
decimal m = jp.Moscow / 4;
if (jpv == null)
{
if (jp.StringValue == dp.StringValue)
sum += m;
continue;
}
if (dpv == null)
continue;
if (jpv <= dpv)
sum += m;
else
sum += m * ((jpv.Value - dpv.Value) / (jpv.Value == 0 ? (decimal)0.000001 : jpv.Value));
}
this.Affinity = sum / (count == 0 ? (decimal)0.000001 : count);
}
}
}
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace Sevomin.Models
{
public class DovominJob
{
[Key]
public long Id { get; set; }
[Index("IX_DovominJobUniqueIndex", Order = 1, IsUnique = true)]
[Required]
[StringLength(128)]
public string DovominId { get; set; }
[Index]
[Index("IX_DovominJobUniqueIndex", Order = 2, IsUnique = true)]
[Required]
public long JobId { get; set; }
[Required]
public DateTime ApplyDate { get; set; }
public string CoverLetter { get; set; }
public decimal Affinity { get; set; }
public bool MinimumRequirement { get; set; }
public DateTime? AvalinSeen { get; set; }
public string AvalinComment { get; set; }
public bool AvalinDelete { get; set; }
public virtual Dovomin Dovomin { get; set; }
public virtual Job Job { get; set; }
public DovominJob(Dovomin dovomin, Job job)
{
this.Dovomin = dovomin;
this.Job = job;
CalculateAffinity();
}
public DovominJob()
{
}
public void CalculateAffinity()
{
if (Dovomin == null || Job == null)
return;
MinimumRequirement = true;
decimal sum = 0;
decimal count = 0;
decimal maxPoint = 0;
Affinity = 0;
foreach (var jp in
Job.JobParameters.Where(x=>x.Moscow != 0 && !string.IsNullOrWhiteSpace(x.StringValue) ))
{
count++;
decimal m = jp.Moscow - 1 ;
maxPoint += jp.Parameter.BasePoint * m;
DovominParameter dp = Dovomin.DovominParameters.SingleOrDefault(x=>x.ParameterId == jp.ParameterId);
if (dp == null)
continue;
if (jp.Moscow == 4)
{
if ((jp.StringValue != dp.StringValue && jp.NumericValue == 0)
|| (jp.NumericValue > 0 && jp.NumericValue > dp.NumericValue))
{
MinimumRequirement = false;
}
}
decimal? dpv = dp.NumericValue;
decimal? jpv = jp.NumericValue;
if (jpv == null)
{
if (jp.StringValue == dp.StringValue)
sum += m * jp.Parameter.BasePoint;
continue;
}
if (dpv == null)
continue;
if (jpv <= dpv)
sum += m * jp.Parameter.BasePoint;
//v2
//if (jpv <= dpv)
// sum += m;
//else
// sum += m * ((jpv.Value - dpv.Value) / (jpv.Value == 0 ? (decimal)0.000001 : jpv.Value));
}
if (maxPoint == 0)
this.Affinity = 100;
this.Affinity = Math.Round( sum / maxPoint, 2, MidpointRounding.ToEven) * 100;
}
}
}

+ 29
- 0
Sevomin.Models/Migrations/201409010546480_basepoint.Designer.cs View File

@ -0,0 +1,29 @@
// <auto-generated />
namespace Sevomin.Models.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.0-30225")]
public sealed partial class basepoint : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(basepoint));
string IMigrationMetadata.Id
{
get { return "201409010546480_basepoint"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

+ 266
- 0
Sevomin.Models/Migrations/201409010546480_basepoint.cs View File

@ -0,0 +1,266 @@
namespace Sevomin.Models.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class basepoint : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.DovominJobs",
c => new
{
Id = c.Long(nullable: false, identity: true),
DovominId = c.String(nullable: false, maxLength: 128),
JobId = c.Long(nullable: false),
ApplyDate = c.DateTime(nullable: false),
CoverLetter = c.String(),
Affinity = c.Decimal(nullable: false, precision: 18, scale: 2),
MinimumRequirement = c.Boolean(nullable: false),
AvalinSeen = c.DateTime(),
AvalinComment = c.String(),
AvalinDelete = c.Boolean(nullable: false),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.Dovomin", t => t.DovominId)
.ForeignKey("dbo.Jobs", t => t.JobId, cascadeDelete: true)
.Index(t => new { t.DovominId, t.JobId }, unique: true, name: "IX_DovominJobUniqueIndex")
.Index(t => t.JobId);
CreateTable(
"dbo.AspNetUsers",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
DisplayName = c.String(),
SignUpDate = c.DateTime(nullable: false),
ConfirmationCode = c.String(),
Email = c.String(maxLength: 256),
EmailConfirmed = c.Boolean(nullable: false),
PasswordHash = c.String(),
SecurityStamp = c.String(),
PhoneNumber = c.String(),
PhoneNumberConfirmed = c.Boolean(nullable: false),
TwoFactorEnabled = c.Boolean(nullable: false),
LockoutEndDateUtc = c.DateTime(),
LockoutEnabled = c.Boolean(nullable: false),
AccessFailedCount = c.Int(nullable: false),
UserName = c.String(nullable: false, maxLength: 256),
})
.PrimaryKey(t => t.Id)
.Index(t => t.UserName, unique: true, name: "UserNameIndex");
CreateTable(
"dbo.AspNetUserClaims",
c => new
{
Id = c.Int(nullable: false, identity: true),
UserId = c.String(nullable: false, maxLength: 128),
ClaimType = c.String(),
ClaimValue = c.String(),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.AspNetUsers", t => t.UserId, cascadeDelete: true)
.Index(t => t.UserId);
CreateTable(
"dbo.DovominParameters",
c => new
{
Id = c.Long(nullable: false, identity: true),
ParameterId = c.Long(nullable: false),
DovominId = c.String(nullable: false, maxLength: 128),
StringValue = c.String(),
NumericValue = c.Decimal(precision: 18, scale: 2),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.Dovomin", t => t.DovominId)
.ForeignKey("dbo.Parameters", t => t.ParameterId, cascadeDelete: true)
.Index(t => new { t.ParameterId, t.DovominId }, unique: true, name: "IX_DovominParameterUniqueIndex")
.Index(t => t.DovominId);
CreateTable(
"dbo.Parameters",
c => new
{
Id = c.Long(nullable: false, identity: true),
Name = c.String(nullable: false),
Moscow = c.Boolean(nullable: false),
DisplayMethod = c.Byte(nullable: false),
DisplayFormat = c.String(maxLength: 50),
GroupName = c.String(nullable: false),
CommentAvalin = c.String(maxLength: 140),
CommentDovomin = c.String(maxLength: 140),
ParameterValueId = c.String(maxLength: 50),
BasePoint = c.Int(nullable: false),
})
.PrimaryKey(t => t.Id);
CreateTable(
"dbo.JobParameters",
c => new
{
Id = c.Long(nullable: false, identity: true),
ParameterId = c.Long(nullable: false),
JobId = c.Long(nullable: false),
StringValue = c.String(),
NumericValue = c.Decimal(precision: 18, scale: 2),
Moscow = c.Byte(nullable: false),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.Jobs", t => t.JobId, cascadeDelete: true)
.ForeignKey("dbo.Parameters", t => t.ParameterId, cascadeDelete: true)
.Index(t => new { t.ParameterId, t.JobId }, unique: true, name: "IX_JobParameterUniqueIndex")
.Index(t => t.JobId);
CreateTable(
"dbo.Jobs",
c => new
{
Id = c.Long(nullable: false, identity: true),
AvalinId = c.String(nullable: false, maxLength: 128),
CreateDate = c.DateTime(nullable: false),
ExpireDate = c.DateTime(nullable: false),
Description = c.String(),
ResumeType = c.Byte(nullable: false),
ContactPersonName = c.String(),
ContactPersonPhone = c.String(),
ContactPersonEMail = c.String(),
ShowCompanyName = c.Boolean(nullable: false),
ShowCompanyLogo = c.Boolean(nullable: false),
IsFullTime = c.Boolean(nullable: false),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.Avalin", t => t.AvalinId)
.Index(t => t.AvalinId);
CreateTable(
"dbo.AspNetUserLogins",
c => new
{
LoginProvider = c.String(nullable: false, maxLength: 128),
ProviderKey = c.String(nullable: false, maxLength: 128),
UserId = c.String(nullable: false, maxLength: 128),
})
.PrimaryKey(t => new { t.LoginProvider, t.ProviderKey, t.UserId })
.ForeignKey("dbo.AspNetUsers", t => t.UserId, cascadeDelete: true)
.Index(t => t.UserId);
CreateTable(
"dbo.AspNetUserRoles",
c => new
{
UserId = c.String(nullable: false, maxLength: 128),
RoleId = c.String(nullable: false, maxLength: 128),
})
.PrimaryKey(t => new { t.UserId, t.RoleId })
.ForeignKey("dbo.AspNetRoles", t => t.RoleId, cascadeDelete: true)
.ForeignKey("dbo.AspNetUsers", t => t.UserId, cascadeDelete: true)
.Index(t => t.UserId)
.Index(t => t.RoleId);
CreateTable(
"dbo.ParameterValues",
c => new
{
GroupKey = c.String(nullable: false, maxLength: 50),
Value = c.String(nullable: false, maxLength: 50),
NumbericValue = c.Decimal(nullable: false, precision: 18, scale: 2),
})
.PrimaryKey(t => new { t.GroupKey, t.Value })
.Index(t => t.GroupKey);
CreateTable(
"dbo.AspNetRoles",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
Name = c.String(nullable: false, maxLength: 256),
})
.PrimaryKey(t => t.Id)
.Index(t => t.Name, unique: true, name: "RoleNameIndex");
CreateTable(
"dbo.Dovomin",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
FirstName = c.String(),
LastName = c.String(),
BirthDate = c.DateTime(),
IsFulltime = c.Boolean(nullable: false),
IsPartTime = c.Boolean(nullable: false),
Description = c.String(),
EnglishResume = c.String(),
PersianResume = c.String(),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.AspNetUsers", t => t.Id)
.Index(t => t.Id);
CreateTable(
"dbo.Avalin",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
CompanyName = c.String(nullable: false),
NationalId = c.String(maxLength: 12),
RegisterId = c.String(maxLength: 10),
Address = c.String(),
CompanyPhoneNumber = c.String(),
EMail = c.String(),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.AspNetUsers", t => t.Id)
.Index(t => t.Id);
}
public override void Down()
{
DropForeignKey("dbo.Avalin", "Id", "dbo.AspNetUsers");
DropForeignKey("dbo.Dovomin", "Id", "dbo.AspNetUsers");
DropForeignKey("dbo.AspNetUserRoles", "UserId", "dbo.AspNetUsers");
DropForeignKey("dbo.AspNetUserLogins", "UserId", "dbo.AspNetUsers");
DropForeignKey("dbo.AspNetUserClaims", "UserId", "dbo.AspNetUsers");
DropForeignKey("dbo.AspNetUserRoles", "RoleId", "dbo.AspNetRoles");
DropForeignKey("dbo.JobParameters", "ParameterId", "dbo.Parameters");
DropForeignKey("dbo.JobParameters", "JobId", "dbo.Jobs");
DropForeignKey("dbo.Jobs", "AvalinId", "dbo.Avalin");
DropForeignKey("dbo.DovominJobs", "JobId", "dbo.Jobs");
DropForeignKey("dbo.DovominParameters", "ParameterId", "dbo.Parameters");
DropForeignKey("dbo.DovominParameters", "DovominId", "dbo.Dovomin");
DropForeignKey("dbo.DovominJobs", "DovominId", "dbo.Dovomin");
DropIndex("dbo.Avalin", new[] { "Id" });
DropIndex("dbo.Dovomin", new[] { "Id" });
DropIndex("dbo.AspNetRoles", "RoleNameIndex");
DropIndex("dbo.ParameterValues", new[] { "GroupKey" });
DropIndex("dbo.AspNetUserRoles", new[] { "RoleId" });
DropIndex("dbo.AspNetUserRoles", new[] { "UserId" });
DropIndex("dbo.AspNetUserLogins", new[] { "UserId" });
DropIndex("dbo.Jobs", new[] { "AvalinId" });
DropIndex("dbo.JobParameters", new[] { "JobId" });
DropIndex("dbo.JobParameters", "IX_JobParameterUniqueIndex");
DropIndex("dbo.DovominParameters", new[] { "DovominId" });
DropIndex("dbo.DovominParameters", "IX_DovominParameterUniqueIndex");
DropIndex("dbo.AspNetUserClaims", new[] { "UserId" });
DropIndex("dbo.AspNetUsers", "UserNameIndex");
DropIndex("dbo.DovominJobs", new[] { "JobId" });
DropIndex("dbo.DovominJobs", "IX_DovominJobUniqueIndex");
DropTable("dbo.Avalin");
DropTable("dbo.Dovomin");
DropTable("dbo.AspNetRoles");
DropTable("dbo.ParameterValues");
DropTable("dbo.AspNetUserRoles");
DropTable("dbo.AspNetUserLogins");
DropTable("dbo.Jobs");
DropTable("dbo.JobParameters");
DropTable("dbo.Parameters");
DropTable("dbo.DovominParameters");
DropTable("dbo.AspNetUserClaims");
DropTable("dbo.AspNetUsers");
DropTable("dbo.DovominJobs");
}
}
}

+ 126
- 0
Sevomin.Models/Migrations/201409010546480_basepoint.resx
File diff suppressed because it is too large
View File


+ 51
- 50
Sevomin.Models/Parameter.cs View File

@ -1,50 +1,51 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace Sevomin.Models
{
public class Parameter
{
[Key]
public long Id { get; set; }
[Required]
public string Name { get; set; }
[Required]
public bool Moscow { get; set; }
[Required]
public byte DisplayMethod { get; set; }
[StringLength(50)]
public string DisplayFormat { get; set; }
[Required]
public string GroupName { get; set; }
[StringLength(140)]
public string CommentAvalin { get; set; }
[StringLength(140)]
public string CommentDovomin { get; set; }
[StringLength(50)]
public string ParameterValueId { get; set; }
[NotMapped]
public IQueryable<ParameterValue> ParameterValues
{
get
{
return SevominDbContext.Current.ParameterValues.Where(x => x.GroupKey == ParameterValueId);
}
}
public virtual ICollection<JobParameter> JobParameters { get; set; }
public virtual ICollection<DovominParameter> DovominParameters { get; set; }
}
}
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace Sevomin.Models
{
public class Parameter
{
[Key]
public long Id { get; set; }
[Required]
public string Name { get; set; }
[Required]
public bool Moscow { get; set; }
[Required]
public byte DisplayMethod { get; set; }
[StringLength(50)]
public string DisplayFormat { get; set; }
[Required]
public string GroupName { get; set; }
[StringLength(140)]
public string CommentAvalin { get; set; }
[StringLength(140)]
public string CommentDovomin { get; set; }
[StringLength(50)]
public string ParameterValueId { get; set; }
[NotMapped]
public IQueryable<ParameterValue> ParameterValues
{
get
{
return SevominDbContext.Current.ParameterValues.Where(x => x.GroupKey == ParameterValueId);
}
}
public int BasePoint { get; set; }
public virtual ICollection<JobParameter> JobParameters { get; set; }
public virtual ICollection<DovominParameter> DovominParameters { get; set; }
}
}

+ 149
- 140
Sevomin.Models/Sevomin.Models.csproj View File

@ -1,141 +1,150 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{CB5D89BC-10D1-44D6-857B-A94B5CFCFB11}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sevomin.Models</RootNamespace>
<AssemblyName>Sevomin.Models</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\EntityFramework.6.1.0\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\EntityFramework.6.1.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="FluentScheduler">
<HintPath>..\packages\FluentScheduler.3.1.42\lib\net40\FluentScheduler.dll</HintPath>
</Reference>
<Reference Include="MailChimp">
<HintPath>..\packages\MailChimp.NET.1.1.0.2\lib\net40\MailChimp.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNet.Identity.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.AspNet.Identity.Core.2.0.0\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNet.Identity.EntityFramework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.AspNet.Identity.EntityFramework.2.0.0\lib\net45\Microsoft.AspNet.Identity.EntityFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin">
<HintPath>..\packages\Microsoft.Owin.2.1.0\lib\net45\Microsoft.Owin.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Host.SystemWeb">
<HintPath>..\packages\Microsoft.Owin.Host.SystemWeb.2.1.0\lib\net45\Microsoft.Owin.Host.SystemWeb.dll</HintPath>
</Reference>
<Reference Include="Owin">
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Text">
<HintPath>..\packages\ServiceStack.Text.3.9.71\lib\net35\ServiceStack.Text.dll</HintPath>
</Reference>
<Reference Include="ShortGuid">
<HintPath>..\packages\ShortGuid.1.0.0\lib\net45\ShortGuid.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.0.0\lib\net45\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Avalin.cs" />
<Compile Include="AvalinViewModel.cs" />
<Compile Include="ChangePasswordViewModel.cs" />
<Compile Include="Helpers\ScheduledTasks\ExpiringJob.cs" />
<Compile Include="Helpers\ScheduledTasks\NewJob.cs" />
<Compile Include="Helpers\ScheduledTasks\NewApplication.cs" />
<Compile Include="Helpers\SevominRegistry.cs" />
<Compile Include="ResetPasswordViewModel.cs" />
<Compile Include="ForgotPasswordViewModel.cs" />
<Compile Include="DovominJob.cs" />
<Compile Include="DovominJobViewModel.cs" />
<Compile Include="DovominParameterViewModel.cs" />
<Compile Include="DovominViewModel.cs" />
<Compile Include="DovominParameter.cs" />
<Compile Include="Dovomin.cs" />
<Compile Include="Enums\MuSCoW.cs" />
<Compile Include="Enums\ResumeTypes.cs" />
<Compile Include="Helpers\DateAssist.cs" />
<Compile Include="Helpers\EmailValidationAttribute.cs" />
<Compile Include="Helpers\Make Use Of Enums %28They are pretty useless without this file!%29.cs" />
<Compile Include="Helpers\SevominEmailer.cs" />
<Compile Include="Helpers\SevominUserStore.cs" />
<Compile Include="Helpers\SevominUserValidator.cs" />
<Compile Include="Job.cs" />
<Compile Include="JobApplicationViewModel.cs" />
<Compile Include="JobMiniViewModel.cs" />
<Compile Include="JobParameter.cs" />
<Compile Include="JobParameterViewModel.cs" />
<Compile Include="JobViewModel.cs" />
<Compile Include="LoginViewModel.cs" />
<Compile Include="Migrations\Configuration.cs" />
<Compile Include="Parameter.cs" />
<Compile Include="ParameterValue.cs" />
<Compile Include="PostResultViewModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Repositories\IRepository.cs" />
<Compile Include="Repositories\JobRepository.cs" />
<Compile Include="Repositories\ParameterRepository.cs" />
<Compile Include="Helpers\SevominUserManager.cs" />
<Compile Include="Repositories\UserRepository.cs" />
<Compile Include="SignupViewModel.cs" />
<Compile Include="User.cs" />
<Compile Include="SevominDbContext.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{CB5D89BC-10D1-44D6-857B-A94B5CFCFB11}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sevomin.Models</RootNamespace>
<AssemblyName>Sevomin.Models</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\EntityFramework.6.1.0\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\EntityFramework.6.1.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="FluentScheduler">
<HintPath>..\packages\FluentScheduler.3.1.42\lib\net40\FluentScheduler.dll</HintPath>
</Reference>
<Reference Include="MailChimp">
<HintPath>..\packages\MailChimp.NET.1.1.0.2\lib\net40\MailChimp.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNet.Identity.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.AspNet.Identity.Core.2.0.0\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNet.Identity.EntityFramework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.AspNet.Identity.EntityFramework.2.0.0\lib\net45\Microsoft.AspNet.Identity.EntityFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin">
<HintPath>..\packages\Microsoft.Owin.2.1.0\lib\net45\Microsoft.Owin.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Host.SystemWeb">
<HintPath>..\packages\Microsoft.Owin.Host.SystemWeb.2.1.0\lib\net45\Microsoft.Owin.Host.SystemWeb.dll</HintPath>
</Reference>
<Reference Include="Owin">
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Text">
<HintPath>..\packages\ServiceStack.Text.3.9.71\lib\net35\ServiceStack.Text.dll</HintPath>
</Reference>
<Reference Include="ShortGuid">
<HintPath>..\packages\ShortGuid.1.0.0\lib\net45\ShortGuid.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.0.0\lib\net45\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Avalin.cs" />
<Compile Include="AvalinViewModel.cs" />
<Compile Include="ChangePasswordViewModel.cs" />
<Compile Include="Helpers\ScheduledTasks\ExpiringJob.cs" />
<Compile Include="Helpers\ScheduledTasks\NewJob.cs" />
<Compile Include="Helpers\ScheduledTasks\NewApplication.cs" />
<Compile Include="Helpers\SevominRegistry.cs" />
<Compile Include="Migrations\201409010546480_basepoint.cs" />
<Compile Include="Migrations\201409010546480_basepoint.Designer.cs">
<DependentUpon>201409010546480_basepoint.cs</DependentUpon>
</Compile>
<Compile Include="ResetPasswordViewModel.cs" />
<Compile Include="ForgotPasswordViewModel.cs" />
<Compile Include="DovominJob.cs" />
<Compile Include="DovominJobViewModel.cs" />
<Compile Include="DovominParameterViewModel.cs" />
<Compile Include="DovominViewModel.cs" />
<Compile Include="DovominParameter.cs" />
<Compile Include="Dovomin.cs" />
<Compile Include="Enums\MuSCoW.cs" />
<Compile Include="Enums\ResumeTypes.cs" />
<Compile Include="Helpers\DateAssist.cs" />
<Compile Include="Helpers\EmailValidationAttribute.cs" />
<Compile Include="Helpers\Make Use Of Enums %28They are pretty useless without this file!%29.cs" />
<Compile Include="Helpers\SevominEmailer.cs" />
<Compile Include="Helpers\SevominUserStore.cs" />
<Compile Include="Helpers\SevominUserValidator.cs" />
<Compile Include="Job.cs" />
<Compile Include="JobApplicationViewModel.cs" />
<Compile Include="JobMiniViewModel.cs" />
<Compile Include="JobParameter.cs" />
<Compile Include="JobParameterViewModel.cs" />
<Compile Include="JobViewModel.cs" />
<Compile Include="LoginViewModel.cs" />
<Compile Include="Migrations\Configuration.cs" />
<Compile Include="Parameter.cs" />
<Compile Include="ParameterValue.cs" />
<Compile Include="PostResultViewModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Repositories\IRepository.cs" />
<Compile Include="Repositories\JobRepository.cs" />
<Compile Include="Repositories\ParameterRepository.cs" />
<Compile Include="Helpers\SevominUserManager.cs" />
<Compile Include="Repositories\UserRepository.cs" />
<Compile Include="SignupViewModel.cs" />
<Compile Include="User.cs" />
<Compile Include="SevominDbContext.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Migrations\201409010546480_basepoint.resx">
<DependentUpon>201409010546480_basepoint.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

+ 46
- 46
Sevomin.Models/SevominDbContext.cs View File

@ -1,46 +1,46 @@
using Microsoft.AspNet.Identity.EntityFramework;
using System;
using System.Data.Entity;
using System.Web;
namespace Sevomin.Models
{
public class SevominDbContext : IdentityDbContext<User>
{
#region Singleton
private static object locker = new object();
public SevominDbContext() : base("SevominConnectionString") { }
public static SevominDbContext Current
{
get
{
lock (locker)
{
if (HttpContext.Current.Items["DataContexMember"] != null &&
HttpContext.Current.Items["DataContexMember"] is SevominDbContext)
return (SevominDbContext)HttpContext.Current.Items["DataContexMember"];
RenewMember();
return (SevominDbContext)HttpContext.Current.Items["DataContexMember"];
}
}
}
public static void RenewMember()
{
SevominDbContext pe =
new SevominDbContext();
HttpContext.Current.Items["DataContexMember"] = pe;
GC.Collect();
}
#endregion
public DbSet<Parameter> Parameters { get; set; }
public DbSet<ParameterValue> ParameterValues { get; set; }
public DbSet<Job> Jobs { get; set; }
public DbSet<DovominJob> DovominJobs { get; set; }
}
}
using Microsoft.AspNet.Identity.EntityFramework;
using System;
using System.Data.Entity;
using System.Web;
namespace Sevomin.Models
{
public class SevominDbContext : IdentityDbContext<User>
{
#region Singleton
private static object locker = new object();
public SevominDbContext() : base("SevominConnectionString") { }
public static SevominDbContext Current
{
get
{
lock (locker)
{
if (HttpContext.Current.Items["DataContexMember"] != null &&
HttpContext.Current.Items["DataContexMember"] is SevominDbContext)
return (SevominDbContext)HttpContext.Current.Items["DataContexMember"];
RenewMember();
return (SevominDbContext)HttpContext.Current.Items["DataContexMember"];
}
}
}
public static void RenewMember()
{
SevominDbContext pe =
new SevominDbContext();
HttpContext.Current.Items["DataContexMember"] = pe;
GC.Collect();
}
#endregion
public DbSet<Parameter> Parameters { get; set; }
public DbSet<ParameterValue> ParameterValues { get; set; }
public DbSet<Job> Jobs { get; set; }
public DbSet<DovominJob> DovominJobs { get; set; }
}
}

Loading…
Cancel
Save