Browse Source

dovomin paramters

confirmation-email
J 11 years ago
parent
commit
61c1b39e2b
11 changed files with 425 additions and 2 deletions
  1. +11
    -0
      Sevomin.Models/Dovomin.cs
  2. +62
    -0
      Sevomin.Models/DovominParameter.cs
  3. +53
    -0
      Sevomin.Models/DovominParameterViewModel.cs
  4. +81
    -0
      Sevomin.Models/DovominViewModel.cs
  5. +1
    -1
      Sevomin.Models/JobViewModel.cs
  6. +29
    -0
      Sevomin.Models/Migrations/201403300806354_DovominParameter.Designer.cs
  7. +50
    -0
      Sevomin.Models/Migrations/201403300806354_DovominParameter.cs
  8. +126
    -0
      Sevomin.Models/Migrations/201403300806354_DovominParameter.resx
  9. +1
    -0
      Sevomin.Models/Parameter.cs
  10. +10
    -0
      Sevomin.Models/Sevomin.Models.csproj
  11. +1
    -1
      Sevomin.WebFrontend.Controllers/JobController.cs

+ 11
- 0
Sevomin.Models/Dovomin.cs View File

@ -1,4 +1,6 @@
 
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace Sevomin.Models namespace Sevomin.Models
{ {
@ -7,6 +9,15 @@ namespace Sevomin.Models
{ {
public string FirstName { get; set; } public string FirstName { get; set; }
public string LastName { get; set; } public string LastName { get; set; }
public DateTime BirthDate { get; set; }
public bool IsFulltime { get; set; }
public bool IsPartTime { get; set; }
public string Description { get; set; }
public string EnglishResume { get; set; }
public string PersianResume { get; set; }
public virtual ICollection<DovominParameter> DovominParameters { get; set; }
public Dovomin() public Dovomin()
{ {


+ 62
- 0
Sevomin.Models/DovominParameter.cs View File

@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sevomin.Models
{
public class DovominParameter
{
[Key]
public long Id { get; set; }
[Index("IX_DovominParameterUniqueIndex", Order = 1, IsUnique = true)]
[Required]
public long ParameterId { get; set; }
[Index]
[Index("IX_DovominParameterUniqueIndex", Order=2, IsUnique=true)]
[Required]
[StringLength(128)]
public string DovominId { get; set; }
public string StringValue { get; private set; }
public decimal? NumericValue { get; private set; }
public byte Moscow { get; set; }
public virtual Parameter Parameter { get; set; }
public virtual Dovomin Dovomin { get; set; }
public DovominParameter()
{}
public DovominParameter(Dovomin dovomin, Parameter parameter)
{
this.Dovomin = dovomin;
this.Parameter = parameter;
this.StringValue = "";
this.NumericValue = null;
this.Moscow = 0;
}
public void SetValue(string value)
{
decimal val;
if (decimal.TryParse(value, out val))
{
NumericValue = val;
StringValue = value;
}
else
{
NumericValue = null;
StringValue = value;
}
}
}
}

+ 53
- 0
Sevomin.Models/DovominParameterViewModel.cs View File

@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sevomin.Models
{
public class DovominParameterViewModel
{
public string StringValue { get; private set; }
public byte MoscowValue { get; set; }
public long Id { get; set; }
public long ParameterId { get; set; }
public string DovominId { get; set; }
public string ParameterName { get; set; }
public bool HasMoscow { get; set; }
public byte DisplayMethod { get; set; }
public string GroupName { get; set; }
public string CommentAvalin { get; set; }
public string CommentDovomin { get; set; }
public IList<Tuple<decimal,string>> ParameterValues { get; set; }
public DovominParameterViewModel(DovominParameter dp)
{
StringValue = dp.StringValue;
MoscowValue = dp.Moscow;
Id = dp.Id;
ParameterId = dp.Parameter.Id;
DovominId = dp.Dovomin.Id;
ParameterName = dp.Parameter.Name;
HasMoscow = dp.Parameter.Moscow;
DisplayMethod = dp.Parameter.DisplayMethod;
GroupName = dp.Parameter.GroupName;
CommentAvalin = dp.Parameter.CommentAvalin;
CommentDovomin = dp.Parameter.CommentDovomin;
ParameterValues = new List<Tuple<decimal, string>>();
foreach (var val in dp.Parameter.ParameterValues)
{
ParameterValues.Add(new Tuple<decimal, string>(val.NumbericValue, val.Value));
}
}
}
}

+ 81
- 0
Sevomin.Models/DovominViewModel.cs View File

@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sevomin.Models.Helpers;
using System.ComponentModel;
namespace Sevomin.Models
{
public class DovominViewModel
{
[Required]
[StringLength(128)]
public string Id { get; set; }
[DisplayName("نام")]
public string FirstName { get; set; }
[DisplayName("نام خانوادگی")]
public string LastName { get; set; }
[DisplayName("تاریخ تولد")]
[DataType(DataType.Date)]
public DateTime BirthDate { get; set; }
[DisplayName("تاریخ تولد")]
[DataType(DataType.Date)]
public string JalaliBirthDate
{
get
{
return DateAssist.ToShamsi(this.BirthDate);
}
set
{
BirthDate = DateAssist.ValidateAndSetToMiladi(value) ?? DateTime.MinValue;
}
}
[DisplayName("دوره‌های آموزشی")]
public string Description { get; set; }
[DisplayName("رزومه انگلیسی")]
public string EnglishResume { get; set; }
[DisplayName("رزومه فارسی")]
public string PersianResume { get; set; }
[DisplayName("تمام وقت")]
public bool IsFullTime { get; set; }
[DisplayName("پاره وقت")]
public bool IsPartTime { get; set; }
public IList<DovominParameterViewModel> Parameters;
public DovominViewModel(Dovomin dovomin)
{
this.Id = dovomin.Id;
this.FirstName = dovomin.FirstName;
this.LastName = dovomin.LastName;
this.IsFullTime = dovomin.IsFulltime;
this.IsPartTime = dovomin.IsPartTime;
this.BirthDate = dovomin.BirthDate == DateTime.MinValue ? DateTime.Now : dovomin.BirthDate;
this.Description = dovomin.Description;
this.EnglishResume = dovomin.EnglishResume;
this.PersianResume = dovomin.PersianResume;
if (dovomin.DovominParameters == null)
return;
Parameters = new List<DovominParameterViewModel>();
foreach (var jp in dovomin.DovominParameters)
{
Parameters.Add(new DovominParameterViewModel(jp));
}
}
}
}

+ 1
- 1
Sevomin.Models/JobViewModel.cs View File

@ -67,7 +67,7 @@ namespace Sevomin.Models
{ {
this.Id = job.Id; this.Id = job.Id;
this.AvalinId = job.AvalinId; this.AvalinId = job.AvalinId;
this.ExpireDate = job.ExpireDate == DateTime.MinValue ? DateTime.Now : job.ExpireDate;
this.ExpireDate = job.ExpireDate == DateTime.MinValue ? DateTime.Now.AddDays(14) : job.ExpireDate;
this.Description = job.Description; this.Description = job.Description;
this.ResumeType = job.ResumeType; this.ResumeType = job.ResumeType;
this.ContactPersonEMail = job.ContactPersonEMail; this.ContactPersonEMail = job.ContactPersonEMail;


+ 29
- 0
Sevomin.Models/Migrations/201403300806354_DovominParameter.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 DovominParameter : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(DovominParameter));
string IMigrationMetadata.Id
{
get { return "201403300806354_DovominParameter"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

+ 50
- 0
Sevomin.Models/Migrations/201403300806354_DovominParameter.cs View File

@ -0,0 +1,50 @@
namespace Sevomin.Models.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class DovominParameter : DbMigration
{
public override void Up()
{
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),
Moscow = c.Byte(nullable: false),
})
.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);
AddColumn("dbo.Dovomin", "BirthDate", c => c.DateTime(nullable: false));
AddColumn("dbo.Dovomin", "IsFulltime", c => c.Boolean(nullable: false));
AddColumn("dbo.Dovomin", "IsPartTime", c => c.Boolean(nullable: false));
AddColumn("dbo.Dovomin", "Description", c => c.String());
AddColumn("dbo.Dovomin", "EnglishResume", c => c.String());
AddColumn("dbo.Dovomin", "PersianResume", c => c.String());
}
public override void Down()
{
DropForeignKey("dbo.DovominParameters", "ParameterId", "dbo.Parameters");
DropForeignKey("dbo.DovominParameters", "DovominId", "dbo.Dovomin");
DropIndex("dbo.DovominParameters", new[] { "DovominId" });
DropIndex("dbo.DovominParameters", "IX_DovominParameterUniqueIndex");
DropColumn("dbo.Dovomin", "PersianResume");
DropColumn("dbo.Dovomin", "EnglishResume");
DropColumn("dbo.Dovomin", "Description");
DropColumn("dbo.Dovomin", "IsPartTime");
DropColumn("dbo.Dovomin", "IsFulltime");
DropColumn("dbo.Dovomin", "BirthDate");
DropTable("dbo.DovominParameters");
}
}
}

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


+ 1
- 0
Sevomin.Models/Parameter.cs View File

@ -46,5 +46,6 @@ namespace Sevomin.Models
} }
public virtual ICollection<JobParameter> JobParameters { get; set; } public virtual ICollection<JobParameter> JobParameters { get; set; }
public virtual ICollection<DovominParameter> DovominParameters { get; set; }
} }
} }

+ 10
- 0
Sevomin.Models/Sevomin.Models.csproj View File

@ -62,6 +62,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Avalin.cs" /> <Compile Include="Avalin.cs" />
<Compile Include="DovominParameterViewModel.cs" />
<Compile Include="DovominViewModel.cs" />
<Compile Include="DovominParameter.cs" />
<Compile Include="Dovomin.cs" /> <Compile Include="Dovomin.cs" />
<Compile Include="Helpers\DateAssist.cs" /> <Compile Include="Helpers\DateAssist.cs" />
<Compile Include="Helpers\EmailValidationAttribute.cs" /> <Compile Include="Helpers\EmailValidationAttribute.cs" />
@ -104,6 +107,10 @@
<Compile Include="Migrations\201403290719225_ParameterValue Change.Designer.cs"> <Compile Include="Migrations\201403290719225_ParameterValue Change.Designer.cs">
<DependentUpon>201403290719225_ParameterValue Change.cs</DependentUpon> <DependentUpon>201403290719225_ParameterValue Change.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Migrations\201403300806354_DovominParameter.cs" />
<Compile Include="Migrations\201403300806354_DovominParameter.Designer.cs">
<DependentUpon>201403300806354_DovominParameter.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\Configuration.cs" /> <Compile Include="Migrations\Configuration.cs" />
<Compile Include="Parameter.cs" /> <Compile Include="Parameter.cs" />
<Compile Include="ParameterValue.cs" /> <Compile Include="ParameterValue.cs" />
@ -145,6 +152,9 @@
<EmbeddedResource Include="Migrations\201403290719225_ParameterValue Change.resx"> <EmbeddedResource Include="Migrations\201403290719225_ParameterValue Change.resx">
<DependentUpon>201403290719225_ParameterValue Change.cs</DependentUpon> <DependentUpon>201403290719225_ParameterValue Change.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Migrations\201403300806354_DovominParameter.resx">
<DependentUpon>201403300806354_DovominParameter.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.


+ 1
- 1
Sevomin.WebFrontend.Controllers/JobController.cs View File

@ -66,7 +66,7 @@ namespace Sevomin.WebFrontend.Controllers
UpdateFields(JalaliExpireDate, ContactPersonName, ContactPersonPhone, UpdateFields(JalaliExpireDate, ContactPersonName, ContactPersonPhone,
ContactPersonEMail, IsFullTime, ShowCompanyName, ContactPersonEMail, IsFullTime, ShowCompanyName,
Description, ShowCompanyLogo, form, job); Description, ShowCompanyLogo, form, job);
JobRepository.Current.Save();
//JobRepository.Current.Save();
} }
catch (Exception) catch (Exception)
{ {


Loading…
Cancel
Save