Browse Source

Dovomin job apply done

confirmation-email
Milad Karbasizadeh 11 years ago
parent
commit
2dbc7dd638
76 changed files with 530 additions and 208 deletions
  1. +2
    -2
      Sevomin.Models/Avalin.cs
  2. +1
    -1
      Sevomin.Models/Dovomin.cs
  3. +11
    -9
      Sevomin.Models/DovominJob.cs
  4. +82
    -0
      Sevomin.Models/DovominJobViewModel.cs
  5. +1
    -6
      Sevomin.Models/DovominParameter.cs
  6. +0
    -4
      Sevomin.Models/DovominParameterViewModel.cs
  7. +11
    -10
      Sevomin.Models/DovominViewModel.cs
  8. +0
    -5
      Sevomin.Models/Enums/MuSCoW.cs
  9. +0
    -5
      Sevomin.Models/Enums/ResumeTypes.cs
  10. +1
    -6
      Sevomin.Models/Helpers/EmailValidationAttribute.cs
  11. +0
    -5
      Sevomin.Models/Helpers/SevominUserManager.cs
  12. +1
    -7
      Sevomin.Models/Helpers/SevominUserStore.cs
  13. +0
    -2
      Sevomin.Models/Helpers/SevominUserValidator.cs
  14. +2
    -5
      Sevomin.Models/Job.cs
  15. +2
    -4
      Sevomin.Models/JobMiniViewModel.cs
  16. +1
    -6
      Sevomin.Models/JobParameter.cs
  17. +0
    -4
      Sevomin.Models/JobParameterViewModel.cs
  18. +3
    -5
      Sevomin.Models/JobViewModel.cs
  19. +0
    -1
      Sevomin.Models/Migrations/201403261205298_InitialCreate.Designer.cs
  20. +0
    -1
      Sevomin.Models/Migrations/201403261205298_InitialCreate.cs
  21. +0
    -1
      Sevomin.Models/Migrations/201403270612529_Avalin_Dovomin_New_Tables.Designer.cs
  22. +0
    -1
      Sevomin.Models/Migrations/201403270612529_Avalin_Dovomin_New_Tables.cs
  23. +0
    -1
      Sevomin.Models/Migrations/201403270618585_National_Id_Avalin.Designer.cs
  24. +0
    -1
      Sevomin.Models/Migrations/201403270618585_National_Id_Avalin.cs
  25. +0
    -1
      Sevomin.Models/Migrations/201403270733330_Avvalin-update.Designer.cs
  26. +0
    -1
      Sevomin.Models/Migrations/201403270733330_Avvalin-update.cs
  27. +0
    -1
      Sevomin.Models/Migrations/201403280733264_Param values.Designer.cs
  28. +0
    -1
      Sevomin.Models/Migrations/201403280733264_Param values.cs
  29. +0
    -1
      Sevomin.Models/Migrations/201403280938368_Job.Designer.cs
  30. +0
    -1
      Sevomin.Models/Migrations/201403280938368_Job.cs
  31. +0
    -1
      Sevomin.Models/Migrations/201403281016428_JobParameter.Designer.cs
  32. +0
    -1
      Sevomin.Models/Migrations/201403281016428_JobParameter.cs
  33. +0
    -1
      Sevomin.Models/Migrations/201403290719225_ParameterValue Change.Designer.cs
  34. +0
    -1
      Sevomin.Models/Migrations/201403290719225_ParameterValue Change.cs
  35. +0
    -1
      Sevomin.Models/Migrations/201403300806354_DovominParameter.Designer.cs
  36. +0
    -1
      Sevomin.Models/Migrations/201403300806354_DovominParameter.cs
  37. +0
    -1
      Sevomin.Models/Migrations/201403301120307_remove-dovominParameter-moscow.Designer.cs
  38. +0
    -1
      Sevomin.Models/Migrations/201403301120307_remove-dovominParameter-moscow.cs
  39. +0
    -1
      Sevomin.Models/Migrations/201403310557099_Job CreateDate.Designer.cs
  40. +0
    -1
      Sevomin.Models/Migrations/201403310557099_Job CreateDate.cs
  41. +0
    -1
      Sevomin.Models/Migrations/201403310658336_DispalyFormat.Designer.cs
  42. +0
    -1
      Sevomin.Models/Migrations/201403310658336_DispalyFormat.cs
  43. +0
    -1
      Sevomin.Models/Migrations/201403310716012_bugfix.Designer.cs
  44. +0
    -1
      Sevomin.Models/Migrations/201403310716012_bugfix.cs
  45. +0
    -1
      Sevomin.Models/Migrations/201403311237412_DovominJob.Designer.cs
  46. +0
    -1
      Sevomin.Models/Migrations/201403311237412_DovominJob.cs
  47. +29
    -0
      Sevomin.Models/Migrations/201404051222069_Dovomin_Birthday_Made_Nullable.Designer.cs
  48. +18
    -0
      Sevomin.Models/Migrations/201404051222069_Dovomin_Birthday_Made_Nullable.cs
  49. +126
    -0
      Sevomin.Models/Migrations/201404051222069_Dovomin_Birthday_Made_Nullable.resx
  50. +0
    -3
      Sevomin.Models/Migrations/Configuration.cs
  51. +2
    -6
      Sevomin.Models/Parameter.cs
  52. +1
    -6
      Sevomin.Models/ParameterValue.cs
  53. +1
    -6
      Sevomin.Models/PostResultViewModel.cs
  54. +2
    -2
      Sevomin.Models/Repositories/IRepository.cs
  55. +18
    -3
      Sevomin.Models/Repositories/JobRepository.cs
  56. +1
    -5
      Sevomin.Models/Repositories/ParameterRepository.cs
  57. +9
    -1
      Sevomin.Models/Sevomin.Models.csproj
  58. +3
    -5
      Sevomin.Models/SevominDbContext.cs
  59. +0
    -4
      Sevomin.Tests/Controllers/FakeIdentity.cs
  60. +4
    -8
      Sevomin.Tests/Controllers/Job/NewJob.cs
  61. +1
    -6
      Sevomin.Tests/FakeDbContext.cs
  62. +3
    -6
      Sevomin.Tests/FakeJobRepository.cs
  63. +14
    -2
      Sevomin.WebFrontend.Controllers/AccountController.cs
  64. +1
    -1
      Sevomin.WebFrontend.Controllers/AuthorizedController.cs
  65. +66
    -17
      Sevomin.WebFrontend.Controllers/JobController.cs
  66. +12
    -0
      Sevomin.WebFrontend/App_Start/RouteConfig.cs
  67. +2
    -1
      Sevomin.WebFrontend/Global.asax.cs
  68. +2
    -0
      Sevomin.WebFrontend/Sevomin.WebFrontend.csproj
  69. +27
    -0
      Sevomin.WebFrontend/Views/Job/Apply.cshtml
  70. +2
    -0
      Sevomin.WebFrontend/Views/Job/Edit.cshtml
  71. +43
    -0
      Sevomin.WebFrontend/Views/Job/JobDigest.cshtml
  72. +4
    -1
      Sevomin.WebFrontend/Views/Job/JobList.cshtml
  73. +2
    -0
      Sevomin.WebFrontend/Views/Job/NewJob.cshtml
  74. +6
    -3
      Sevomin.WebFrontend/Views/Job/SingleJob.cshtml
  75. +13
    -3
      Sevomin.WebFrontend/Web.config
  76. +0
    -5
      Sevomin.sln

+ 2
- 2
Sevomin.Models/Avalin.cs View File

@ -1,7 +1,7 @@
using System.Collections.Generic;
using Sevomin.Models.Helpers;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using Sevomin.Models.Helpers;
namespace Sevomin.Models namespace Sevomin.Models
{ {


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

@ -9,7 +9,7 @@ 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 DateTime? BirthDate { get; set; }
public bool IsFulltime { get; set; } public bool IsFulltime { get; set; }
public bool IsPartTime { get; set; } public bool IsPartTime { get; set; }
public string Description { get; set; } public string Description { get; set; }


+ 11
- 9
Sevomin.Models/DovominJob.cs View File

@ -1,10 +1,7 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sevomin.Models namespace Sevomin.Models
{ {
@ -49,6 +46,11 @@ namespace Sevomin.Models
CalculateAffinity(); CalculateAffinity();
} }
public DovominJob()
{
}
private void CalculateAffinity() private void CalculateAffinity()
{ {
MinimumRequirement = true; MinimumRequirement = true;
@ -58,18 +60,18 @@ namespace Sevomin.Models
foreach (var jp in foreach (var jp in
Job.JobParameters.Where(x=>x.Moscow != 0 && !string.IsNullOrWhiteSpace(x.StringValue) )) Job.JobParameters.Where(x=>x.Moscow != 0 && !string.IsNullOrWhiteSpace(x.StringValue) ))
{ {
count++;
DovominParameter dp = Dovomin.DovominParameters.SingleOrDefault(x=>x.ParameterId == jp.ParameterId); DovominParameter dp = Dovomin.DovominParameters.SingleOrDefault(x=>x.ParameterId == jp.ParameterId);
if (dp == null)
continue;
if (jp.Moscow == 4) if (jp.Moscow == 4)
{ {
if (dp == null)
MinimumRequirement = false;
if ((jp.StringValue != dp.StringValue && jp.NumericValue == 0) ||
(jp.NumericValue > 0 && jp.NumericValue > dp.NumericValue))
if ((jp.StringValue != dp.StringValue && jp.NumericValue == 0)
|| (jp.NumericValue > 0 && jp.NumericValue > dp.NumericValue))
{ {
MinimumRequirement = false; MinimumRequirement = false;
} }
}
count++;
}
decimal? dpv = dp.NumericValue; decimal? dpv = dp.NumericValue;
decimal? jpv = jp.NumericValue; decimal? jpv = jp.NumericValue;


+ 82
- 0
Sevomin.Models/DovominJobViewModel.cs View File

@ -0,0 +1,82 @@
using Sevomin.Models.Helpers;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sevomin.Models
{
public class DovominJobViewModel
{
public long Id { get; set; }
public string DovominId { get; set; }
public long JobId { get; set; }
public DateTime ApplyDate { get; set; }
public string JalaliApplyDate
{
get
{
return DateAssist.ToShamsi(this.ApplyDate);
}
set
{
ApplyDate = DateAssist.ValidateAndSetToMiladi(value) ?? DateTime.MinValue;
}
}
[Required(ErrorMessage = "ورود {0} الزامی است.")]
[DisplayName("نامه خصوصی برای کارفرما")]
public string CoverLetter { get; set; }
public decimal Affinity { get; set; }
public bool MinimumRequirement { get; set; }
public DateTime? AvalinSeen { get; set; }
public string JalaliAvalinSeen
{
get
{
if(AvalinSeen.HasValue)
return DateAssist.ToShamsi(this.AvalinSeen.Value);
return null;
}
set
{
AvalinSeen = DateAssist.ValidateAndSetToMiladi(value) ?? DateTime.MinValue;
}
}
public string AvalinComment { get; set; }
public bool AvalinDelete { get; set; }
public DovominJobViewModel(DovominJob dovominJob)
{
this.Id = dovominJob.Id;
this.DovominId = dovominJob.DovominId;
this.JobId = dovominJob.JobId;
this.ApplyDate = dovominJob.ApplyDate;
this.CoverLetter = dovominJob.CoverLetter;
this.Affinity = dovominJob.Affinity;
this.MinimumRequirement = dovominJob.MinimumRequirement;
this.AvalinSeen = dovominJob.AvalinSeen;
this.AvalinComment = dovominJob.AvalinComment;
this.AvalinDelete = dovominJob.AvalinDelete;
}
public DovominJobViewModel()
{
}
}
}

+ 1
- 6
Sevomin.Models/DovominParameter.cs View File

@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sevomin.Models namespace Sevomin.Models
{ {


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

@ -1,9 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sevomin.Models namespace Sevomin.Models
{ {


+ 11
- 10
Sevomin.Models/DovominViewModel.cs View File

@ -1,12 +1,10 @@
using System;
using Sevomin.Models.Helpers;
using Sevomin.Models.Repositories;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sevomin.Models.Helpers;
using System.ComponentModel;
using Sevomin.Models.Repositories;
namespace Sevomin.Models namespace Sevomin.Models
{ {
@ -32,7 +30,7 @@ namespace Sevomin.Models
[DisplayName("تاریخ تولد")] [DisplayName("تاریخ تولد")]
[DataType(DataType.Date)] [DataType(DataType.Date)]
public DateTime BirthDate { get; set; }
public DateTime? BirthDate { get; set; }
[DisplayName("تاریخ تولد")] [DisplayName("تاریخ تولد")]
[DataType(DataType.Date)] [DataType(DataType.Date)]
@ -40,11 +38,14 @@ namespace Sevomin.Models
{ {
get get
{ {
return DateAssist.ToShamsi(this.BirthDate);
if (this.BirthDate.HasValue)
return DateAssist.ToShamsi(this.BirthDate.Value);
else
return string.Empty;
} }
set set
{ {
BirthDate = DateAssist.ValidateAndSetToMiladi(value) ?? DateTime.MinValue;
BirthDate = DateAssist.ValidateAndSetToMiladi(value) ?? null;
} }
} }
@ -72,7 +73,7 @@ namespace Sevomin.Models
this.LastName = dovomin.LastName; this.LastName = dovomin.LastName;
this.IsFullTime = dovomin.IsFulltime; this.IsFullTime = dovomin.IsFulltime;
this.IsPartTime = dovomin.IsPartTime; this.IsPartTime = dovomin.IsPartTime;
this.BirthDate = dovomin.BirthDate == DateTime.MinValue ? DateTime.Now : dovomin.BirthDate;
this.BirthDate = dovomin.BirthDate;
this.Description = dovomin.Description; this.Description = dovomin.Description;
this.EnglishResume = dovomin.EnglishResume; this.EnglishResume = dovomin.EnglishResume;
this.PersianResume = dovomin.PersianResume; this.PersianResume = dovomin.PersianResume;


+ 0
- 5
Sevomin.Models/Enums/MuSCoW.cs View File

@ -1,9 +1,4 @@
using Sevomin.Models.Helpers; using Sevomin.Models.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sevomin.Models.Enums namespace Sevomin.Models.Enums
{ {


+ 0
- 5
Sevomin.Models/Enums/ResumeTypes.cs View File

@ -1,9 +1,4 @@
using Sevomin.Models.Helpers; using Sevomin.Models.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sevomin.Models.Enums namespace Sevomin.Models.Enums
{ {


+ 1
- 6
Sevomin.Models/Helpers/EmailValidationAttribute.cs View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sevomin.Models.Helpers namespace Sevomin.Models.Helpers
{ {
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;


+ 0
- 5
Sevomin.Models/Helpers/SevominUserManager.cs View File

@ -1,9 +1,4 @@
using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sevomin.Models.Helpers namespace Sevomin.Models.Helpers
{ {


+ 1
- 7
Sevomin.Models/Helpers/SevominUserStore.cs View File

@ -1,10 +1,4 @@
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNet.Identity.EntityFramework;
namespace Sevomin.Models.Helpers namespace Sevomin.Models.Helpers
{ {


+ 0
- 2
Sevomin.Models/Helpers/SevominUserValidator.cs View File

@ -1,9 +1,7 @@
using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework; using Microsoft.AspNet.Identity.EntityFramework;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Sevomin.Models.Helpers namespace Sevomin.Models.Helpers


+ 2
- 5
Sevomin.Models/Job.cs View File

@ -1,11 +1,8 @@
using System;
using Sevomin.Models.Helpers;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sevomin.Models.Helpers;
namespace Sevomin.Models namespace Sevomin.Models
{ {


+ 2
- 4
Sevomin.Models/JobMiniViewModel.cs View File

@ -1,11 +1,9 @@
using System;
using Sevomin.Models.Helpers;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sevomin.Models.Helpers;
//استخدام نیروی «کنترل پروژه» با ×× سال سابقه ×× دارای ×مدرک× ×× برای کار در ×کشور×شهر× //استخدام نیروی «کنترل پروژه» با ×× سال سابقه ×× دارای ×مدرک× ×× برای کار در ×کشور×شهر×
namespace Sevomin.Models namespace Sevomin.Models


+ 1
- 6
Sevomin.Models/JobParameter.cs View File

@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sevomin.Models namespace Sevomin.Models
{ {


+ 0
- 4
Sevomin.Models/JobParameterViewModel.cs View File

@ -1,9 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sevomin.Models namespace Sevomin.Models
{ {


+ 3
- 5
Sevomin.Models/JobViewModel.cs View File

@ -1,11 +1,9 @@
using System;
using Sevomin.Models.Helpers;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sevomin.Models.Helpers;
using System.ComponentModel;
namespace Sevomin.Models namespace Sevomin.Models
{ {


+ 0
- 1
Sevomin.Models/Migrations/201403261205298_InitialCreate.Designer.cs View File

@ -2,7 +2,6 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System.CodeDom.Compiler; using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure; using System.Data.Entity.Migrations.Infrastructure;
using System.Resources; using System.Resources;


+ 0
- 1
Sevomin.Models/Migrations/201403261205298_InitialCreate.cs View File

@ -1,6 +1,5 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System;
using System.Data.Entity.Migrations; using System.Data.Entity.Migrations;
public partial class InitialCreate : DbMigration public partial class InitialCreate : DbMigration


+ 0
- 1
Sevomin.Models/Migrations/201403270612529_Avalin_Dovomin_New_Tables.Designer.cs View File

@ -2,7 +2,6 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System.CodeDom.Compiler; using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure; using System.Data.Entity.Migrations.Infrastructure;
using System.Resources; using System.Resources;


+ 0
- 1
Sevomin.Models/Migrations/201403270612529_Avalin_Dovomin_New_Tables.cs View File

@ -1,6 +1,5 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System;
using System.Data.Entity.Migrations; using System.Data.Entity.Migrations;
public partial class Avalin_Dovomin_New_Tables : DbMigration public partial class Avalin_Dovomin_New_Tables : DbMigration


+ 0
- 1
Sevomin.Models/Migrations/201403270618585_National_Id_Avalin.Designer.cs View File

@ -2,7 +2,6 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System.CodeDom.Compiler; using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure; using System.Data.Entity.Migrations.Infrastructure;
using System.Resources; using System.Resources;


+ 0
- 1
Sevomin.Models/Migrations/201403270618585_National_Id_Avalin.cs View File

@ -1,6 +1,5 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System;
using System.Data.Entity.Migrations; using System.Data.Entity.Migrations;
public partial class National_Id_Avalin : DbMigration public partial class National_Id_Avalin : DbMigration


+ 0
- 1
Sevomin.Models/Migrations/201403270733330_Avvalin-update.Designer.cs View File

@ -2,7 +2,6 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System.CodeDom.Compiler; using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure; using System.Data.Entity.Migrations.Infrastructure;
using System.Resources; using System.Resources;


+ 0
- 1
Sevomin.Models/Migrations/201403270733330_Avvalin-update.cs View File

@ -1,6 +1,5 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System;
using System.Data.Entity.Migrations; using System.Data.Entity.Migrations;
public partial class Avvalinupdate : DbMigration public partial class Avvalinupdate : DbMigration


+ 0
- 1
Sevomin.Models/Migrations/201403280733264_Param values.Designer.cs View File

@ -2,7 +2,6 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System.CodeDom.Compiler; using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure; using System.Data.Entity.Migrations.Infrastructure;
using System.Resources; using System.Resources;


+ 0
- 1
Sevomin.Models/Migrations/201403280733264_Param values.cs View File

@ -1,6 +1,5 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System;
using System.Data.Entity.Migrations; using System.Data.Entity.Migrations;
public partial class Paramvalues : DbMigration public partial class Paramvalues : DbMigration


+ 0
- 1
Sevomin.Models/Migrations/201403280938368_Job.Designer.cs View File

@ -2,7 +2,6 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System.CodeDom.Compiler; using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure; using System.Data.Entity.Migrations.Infrastructure;
using System.Resources; using System.Resources;


+ 0
- 1
Sevomin.Models/Migrations/201403280938368_Job.cs View File

@ -1,6 +1,5 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System;
using System.Data.Entity.Migrations; using System.Data.Entity.Migrations;
public partial class Job : DbMigration public partial class Job : DbMigration


+ 0
- 1
Sevomin.Models/Migrations/201403281016428_JobParameter.Designer.cs View File

@ -2,7 +2,6 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System.CodeDom.Compiler; using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure; using System.Data.Entity.Migrations.Infrastructure;
using System.Resources; using System.Resources;


+ 0
- 1
Sevomin.Models/Migrations/201403281016428_JobParameter.cs View File

@ -1,6 +1,5 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System;
using System.Data.Entity.Migrations; using System.Data.Entity.Migrations;
public partial class JobParameter : DbMigration public partial class JobParameter : DbMigration


+ 0
- 1
Sevomin.Models/Migrations/201403290719225_ParameterValue Change.Designer.cs View File

@ -2,7 +2,6 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System.CodeDom.Compiler; using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure; using System.Data.Entity.Migrations.Infrastructure;
using System.Resources; using System.Resources;


+ 0
- 1
Sevomin.Models/Migrations/201403290719225_ParameterValue Change.cs View File

@ -1,6 +1,5 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System;
using System.Data.Entity.Migrations; using System.Data.Entity.Migrations;
public partial class ParameterValueChange : DbMigration public partial class ParameterValueChange : DbMigration


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

@ -2,7 +2,6 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System.CodeDom.Compiler; using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure; using System.Data.Entity.Migrations.Infrastructure;
using System.Resources; using System.Resources;


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

@ -1,6 +1,5 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System;
using System.Data.Entity.Migrations; using System.Data.Entity.Migrations;
public partial class DovominParameter : DbMigration public partial class DovominParameter : DbMigration


+ 0
- 1
Sevomin.Models/Migrations/201403301120307_remove-dovominParameter-moscow.Designer.cs View File

@ -2,7 +2,6 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System.CodeDom.Compiler; using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure; using System.Data.Entity.Migrations.Infrastructure;
using System.Resources; using System.Resources;


+ 0
- 1
Sevomin.Models/Migrations/201403301120307_remove-dovominParameter-moscow.cs View File

@ -1,6 +1,5 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System;
using System.Data.Entity.Migrations; using System.Data.Entity.Migrations;
public partial class removedovominParametermoscow : DbMigration public partial class removedovominParametermoscow : DbMigration


+ 0
- 1
Sevomin.Models/Migrations/201403310557099_Job CreateDate.Designer.cs View File

@ -2,7 +2,6 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System.CodeDom.Compiler; using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure; using System.Data.Entity.Migrations.Infrastructure;
using System.Resources; using System.Resources;


+ 0
- 1
Sevomin.Models/Migrations/201403310557099_Job CreateDate.cs View File

@ -1,6 +1,5 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System;
using System.Data.Entity.Migrations; using System.Data.Entity.Migrations;
public partial class JobCreateDate : DbMigration public partial class JobCreateDate : DbMigration


+ 0
- 1
Sevomin.Models/Migrations/201403310658336_DispalyFormat.Designer.cs View File

@ -2,7 +2,6 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System.CodeDom.Compiler; using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure; using System.Data.Entity.Migrations.Infrastructure;
using System.Resources; using System.Resources;


+ 0
- 1
Sevomin.Models/Migrations/201403310658336_DispalyFormat.cs View File

@ -1,6 +1,5 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System;
using System.Data.Entity.Migrations; using System.Data.Entity.Migrations;
public partial class DispalyFormat : DbMigration public partial class DispalyFormat : DbMigration


+ 0
- 1
Sevomin.Models/Migrations/201403310716012_bugfix.Designer.cs View File

@ -2,7 +2,6 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System.CodeDom.Compiler; using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure; using System.Data.Entity.Migrations.Infrastructure;
using System.Resources; using System.Resources;


+ 0
- 1
Sevomin.Models/Migrations/201403310716012_bugfix.cs View File

@ -1,6 +1,5 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System;
using System.Data.Entity.Migrations; using System.Data.Entity.Migrations;
public partial class bugfix : DbMigration public partial class bugfix : DbMigration


+ 0
- 1
Sevomin.Models/Migrations/201403311237412_DovominJob.Designer.cs View File

@ -2,7 +2,6 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System.CodeDom.Compiler; using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure; using System.Data.Entity.Migrations.Infrastructure;
using System.Resources; using System.Resources;


+ 0
- 1
Sevomin.Models/Migrations/201403311237412_DovominJob.cs View File

@ -1,6 +1,5 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System;
using System.Data.Entity.Migrations; using System.Data.Entity.Migrations;
public partial class DovominJob : DbMigration public partial class DovominJob : DbMigration


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

+ 18
- 0
Sevomin.Models/Migrations/201404051222069_Dovomin_Birthday_Made_Nullable.cs View File

@ -0,0 +1,18 @@
namespace Sevomin.Models.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class Dovomin_Birthday_Made_Nullable : DbMigration
{
public override void Up()
{
AlterColumn("dbo.Dovomin", "BirthDate", c => c.DateTime());
}
public override void Down()
{
AlterColumn("dbo.Dovomin", "BirthDate", c => c.DateTime(nullable: false));
}
}
}

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


+ 0
- 3
Sevomin.Models/Migrations/Configuration.cs View File

@ -1,9 +1,6 @@
namespace Sevomin.Models.Migrations namespace Sevomin.Models.Migrations
{ {
using System;
using System.Data.Entity;
using System.Data.Entity.Migrations; using System.Data.Entity.Migrations;
using System.Linq;
internal sealed class Configuration : DbMigrationsConfiguration<Sevomin.Models.SevominDbContext> internal sealed class Configuration : DbMigrationsConfiguration<Sevomin.Models.SevominDbContext>
{ {


+ 2
- 6
Sevomin.Models/Parameter.cs View File

@ -1,11 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using Sevomin.Models.Helpers;
using System.Linq;
namespace Sevomin.Models namespace Sevomin.Models


+ 1
- 6
Sevomin.Models/ParameterValue.cs View File

@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sevomin.Models namespace Sevomin.Models
{ {


+ 1
- 6
Sevomin.Models/PostResultViewModel.cs View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sevomin.Models namespace Sevomin.Models
{ {
public class PostResultViewModel public class PostResultViewModel


+ 2
- 2
Sevomin.Models/Repositories/IRepository.cs View File

@ -1,5 +1,4 @@
using System.Data.Entity.Core.Objects;
using System.Linq;
using System.Linq;
namespace Sevomin.Models.Repositories namespace Sevomin.Models.Repositories
{ {
@ -20,6 +19,7 @@ namespace Sevomin.Models.Repositories
{ {
Job GetEmptyJobFor(Avalin avalin); Job GetEmptyJobFor(Avalin avalin);
IQueryable<Job> ListAll(); IQueryable<Job> ListAll();
void Apply(Dovomin dovomin, Job job, string coverLetter);
} }
public interface IParameterRepository : IRepository<long, Parameter> public interface IParameterRepository : IRepository<long, Parameter>


+ 18
- 3
Sevomin.Models/Repositories/JobRepository.cs View File

@ -1,8 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sevomin.Models.Repositories namespace Sevomin.Models.Repositories
{ {
@ -83,7 +81,24 @@ namespace Sevomin.Models.Repositories
avalin.Jobs.Add(job); avalin.Jobs.Add(job);
return job; return job;
} }
#endregion
public void Apply(Dovomin dovomin, Job job, string coverLetter)
{
DovominJob dj = new DovominJob(dovomin, job);
dj.ApplyDate = DateTime.UtcNow;
dj.CoverLetter = coverLetter;
if (dovomin.DovominJobs.Any(d => d.JobId == job.Id))
{
dovomin.DovominJobs.First(d => d.JobId == job.Id).CoverLetter = coverLetter;
}
else
{
dovomin.DovominJobs.Add(dj);
}
Save();
}
#endregion
} }
} }

+ 1
- 5
Sevomin.Models/Repositories/ParameterRepository.cs View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Linq;
namespace Sevomin.Models.Repositories namespace Sevomin.Models.Repositories
{ {


+ 9
- 1
Sevomin.Models/Sevomin.Models.csproj View File

@ -63,6 +63,7 @@
<ItemGroup> <ItemGroup>
<Compile Include="Avalin.cs" /> <Compile Include="Avalin.cs" />
<Compile Include="DovominJob.cs" /> <Compile Include="DovominJob.cs" />
<Compile Include="DovominJobViewModel.cs" />
<Compile Include="DovominParameterViewModel.cs" /> <Compile Include="DovominParameterViewModel.cs" />
<Compile Include="DovominViewModel.cs" /> <Compile Include="DovominViewModel.cs" />
<Compile Include="DovominParameter.cs" /> <Compile Include="DovominParameter.cs" />
@ -136,6 +137,10 @@
<Compile Include="Migrations\201403311237412_DovominJob.Designer.cs"> <Compile Include="Migrations\201403311237412_DovominJob.Designer.cs">
<DependentUpon>201403311237412_DovominJob.cs</DependentUpon> <DependentUpon>201403311237412_DovominJob.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Migrations\201404051222069_Dovomin_Birthday_Made_Nullable.cs" />
<Compile Include="Migrations\201404051222069_Dovomin_Birthday_Made_Nullable.Designer.cs">
<DependentUpon>201404051222069_Dovomin_Birthday_Made_Nullable.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" />
@ -147,7 +152,7 @@
<Compile Include="Helpers\SevominUserManager.cs" /> <Compile Include="Helpers\SevominUserManager.cs" />
<Compile Include="SignupViewModel.cs" /> <Compile Include="SignupViewModel.cs" />
<Compile Include="User.cs" /> <Compile Include="User.cs" />
<Compile Include="UsersDbContext.cs" />
<Compile Include="SevominDbContext.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="App.config" /> <None Include="App.config" />
@ -196,6 +201,9 @@
<EmbeddedResource Include="Migrations\201403311237412_DovominJob.resx"> <EmbeddedResource Include="Migrations\201403311237412_DovominJob.resx">
<DependentUpon>201403311237412_DovominJob.cs</DependentUpon> <DependentUpon>201403311237412_DovominJob.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Migrations\201404051222069_Dovomin_Birthday_Made_Nullable.resx">
<DependentUpon>201404051222069_Dovomin_Birthday_Made_Nullable.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.


Sevomin.Models/UsersDbContext.cs → Sevomin.Models/SevominDbContext.cs View File


+ 0
- 4
Sevomin.Tests/Controllers/FakeIdentity.cs View File

@ -1,9 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal; using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
namespace Sevomin.Tests.Controllers namespace Sevomin.Tests.Controllers
{ {


+ 4
- 8
Sevomin.Tests/Controllers/Job/NewJob.cs View File

@ -1,15 +1,11 @@
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
using Sevomin.WebFrontend.Controllers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using Rhino.Mocks; using Rhino.Mocks;
using Sevomin.Models.Helpers; using Sevomin.Models.Helpers;
using System.Web;
using Sevomin.WebFrontend.Controllers;
using System.Security.Principal; using System.Security.Principal;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
namespace Sevomin.Tests.Controllers.Job namespace Sevomin.Tests.Controllers.Job
{ {


+ 1
- 6
Sevomin.Tests/FakeDbContext.cs View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.AspNet.Identity.EntityFramework;
using Rhino.Mocks; using Rhino.Mocks;
using Sevomin.Models; using Sevomin.Models;


+ 3
- 6
Sevomin.Tests/FakeJobRepository.cs View File

@ -1,11 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Rhino.Mocks;
using Rhino.Mocks;
using Sevomin.Models; using Sevomin.Models;
using Sevomin.Models.Repositories; using Sevomin.Models.Repositories;
using System.Collections.Generic;
using System.Linq;
namespace Sevomin.Tests namespace Sevomin.Tests
{ {


+ 14
- 2
Sevomin.WebFrontend.Controllers/AccountController.cs View File

@ -3,11 +3,11 @@ using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.Owin.Security; using Microsoft.Owin.Security;
using Sevomin.Models; using Sevomin.Models;
using Sevomin.Models.Helpers; using Sevomin.Models.Helpers;
using Sevomin.Models.Repositories;
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web; using System.Web;
using System.Web.Mvc; using System.Web.Mvc;
using Sevomin.Models.Repositories;
namespace Sevomin.WebFrontend.Controllers namespace Sevomin.WebFrontend.Controllers
{ {
@ -53,8 +53,20 @@ namespace Sevomin.WebFrontend.Controllers
var result = await UserManager.CreateAsync(user, model.Password); var result = await UserManager.CreateAsync(user, model.Password);
if (result.Succeeded) if (result.Succeeded)
{ {
RoleManager<IdentityRole> roleManager = new RoleManager<IdentityRole>(new RoleStore<IdentityRole>(SevominDbContext.Current));
if (!(await roleManager.RoleExistsAsync("Avalin")))
await roleManager.CreateAsync(new IdentityRole("Avalin"));
if (!(await roleManager.RoleExistsAsync("Dovomin")))
await roleManager.CreateAsync(new IdentityRole("Dovomin"));
if (user is Avalin)
await UserManager.AddToRoleAsync(user.Id, "Avalin");
else if(user is Dovomin)
await UserManager.AddToRoleAsync(user.Id, "Dovomin");
await SignInAsync(user, isPersistent: false); await SignInAsync(user, isPersistent: false);
return RedirectToAction("Index", "Home");
return RedirectToAction("MyProfile", "Account");
} }
else else
{ {


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

@ -1,9 +1,9 @@
using Microsoft.AspNet.Identity.EntityFramework; using Microsoft.AspNet.Identity.EntityFramework;
using Sevomin.Models; using Sevomin.Models;
using Sevomin.Models.Helpers; using Sevomin.Models.Helpers;
using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web.Mvc; using System.Web.Mvc;
using System.IO;
namespace Sevomin.WebFrontend.Controllers namespace Sevomin.WebFrontend.Controllers
{ {


+ 66
- 17
Sevomin.WebFrontend.Controllers/JobController.cs View File

@ -1,16 +1,14 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNet.Identity.EntityFramework;
using Sevomin.Models;
using Sevomin.Models.Enums;
using Sevomin.Models.Helpers;
using Sevomin.Models.Repositories;
using System;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web.Mvc;
using Sevomin.Models;
using Sevomin.Models.Repositories;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using Sevomin.Models.Helpers;
using System.Web; using System.Web;
using Sevomin.Models.Enums;
using System.Web.Mvc;
namespace Sevomin.WebFrontend.Controllers namespace Sevomin.WebFrontend.Controllers
{ {
@ -68,13 +66,16 @@ namespace Sevomin.WebFrontend.Controllers
ContactPersonEMail, IsFullTime, ShowCompanyName, ContactPersonEMail, IsFullTime, ShowCompanyName,
Description, ShowCompanyLogo, ResumeType, form, job); Description, ShowCompanyLogo, ResumeType, form, job);
JobRepository.Current.Save(); JobRepository.Current.Save();
ViewBag.Result = new PostResultViewModel(true, "آگهی شما با موفقیت منتشر شد.");
return RedirectToAction("SingleJob", new { jobId = job.Id });
} }
catch (Exception) catch (Exception)
{ {
JobViewModel jvm = new JobViewModel(job);
return View(jvm);
ViewBag.Result = new PostResultViewModel(true, "در انتشار آگهی خطایی پیش آمده.");
return View(new JobViewModel(job));
} }
return Content("boogh: " + job.Id.ToString());
} }
private async Task<Job> FetchJob(long id) private async Task<Job> FetchJob(long id)
@ -108,13 +109,17 @@ namespace Sevomin.WebFrontend.Controllers
ContactPersonEMail, IsFullTime, ShowCompanyName, ContactPersonEMail, IsFullTime, ShowCompanyName,
Description, ShowCompanyLogo, ResumeType, form, job); Description, ShowCompanyLogo, ResumeType, form, job);
JobRepository.Current.Save(); JobRepository.Current.Save();
ViewBag.Result = new PostResultViewModel(true, "آگهی شما با موفقیت به روز رسانی شد.");
return View(new JobViewModel(job));
} }
catch (Exception) catch (Exception)
{ {
JobViewModel jvm = new JobViewModel(job);
return View(jvm);
ViewBag.Result = new PostResultViewModel(false, "در به روز رسانی آگهی خطایی پیش آمد.");
return View(new JobViewModel(job));
} }
return Content("boogh: " + job.Id.ToString());
} }
public PartialViewResult LatestJobList(int count) public PartialViewResult LatestJobList(int count)
@ -143,7 +148,52 @@ namespace Sevomin.WebFrontend.Controllers
return View(viewModel); return View(viewModel);
} }
[Authorize(Roles = "Dovomin")]
public async Task<ActionResult> Apply(long jobId)
{
Dovomin user = (await UserManager.FindByNameAsync(User.Identity.Name)) as Dovomin;
Job job = _JobRepository.Find(jobId);
if (user == null || job == null)
return HttpNotFound();
DovominJob dj = new DovominJob(user, job);
JobMiniViewModel jvm = new JobMiniViewModel(job, 3);
StringBuilder sb = new StringBuilder("کارشناس برنامه ریزی و کنترل پروژه ");
foreach (var param in jvm.Parameters)
sb.Append(string.Format(param.Item1 + " ", param.Item2));
ViewBag.ShortJobDescription = sb.ToString();
ViewBag.Job = new JobViewModel(job);
return View(new DovominJobViewModel(dj));
}
[Authorize(Roles = "Dovomin")]
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Apply(long jobId, string CoverLetter)
{
Dovomin user = (await UserManager.FindByNameAsync(User.Identity.Name)) as Dovomin;
Job job = _JobRepository.Find(jobId);
if (user == null || job == null)
return HttpNotFound();
_JobRepository.Apply(user, job, CoverLetter);
JobMiniViewModel jvm = new JobMiniViewModel(job, 3);
StringBuilder sb = new StringBuilder("کارشناس برنامه ریزی و کنترل پروژه ");
foreach (var param in jvm.Parameters)
sb.Append(string.Format(param.Item1 + " ", param.Item2));
ViewBag.ShortJobDescription = sb.ToString();
ViewBag.Job = new JobViewModel(job);
ViewBag.Result = new PostResultViewModel(true, "اعلام آمادگی شما برای این فرصت شغلی ثبت شد.");
return View();
}
private static void UpdateFields(string JalaliExpireDate, string ContactPersonName, string ContactPersonPhone, string ContactPersonEMail, bool IsFullTime, bool ShowCompanyName, string Description, bool ShowCompanyLogo, ResumeTypes ResumeType, FormCollection form, Job job) private static void UpdateFields(string JalaliExpireDate, string ContactPersonName, string ContactPersonPhone, string ContactPersonEMail, bool IsFullTime, bool ShowCompanyName, string Description, bool ShowCompanyLogo, ResumeTypes ResumeType, FormCollection form, Job job)
@ -176,6 +226,5 @@ namespace Sevomin.WebFrontend.Controllers
} }
} }
} }
} }
} }

+ 12
- 0
Sevomin.WebFrontend/App_Start/RouteConfig.cs View File

@ -57,6 +57,18 @@ namespace Sevomin.WebFrontend
defaults: new { controller = "Job", action = "NewJob" } defaults: new { controller = "Job", action = "NewJob" }
); );
routes.MapRoute(
name: "EditJob",
url: "jobs/edit-job/{id}",
defaults: new { controller = "Job", action = "Edit" }
);
routes.MapRoute(
name: "JobApply",
url: "jobs/apply/{jobId}",
defaults: new { controller = "Job", action = "Apply" }
);
routes.MapRoute( routes.MapRoute(
name: "SingleJob", name: "SingleJob",
url: "jobs/{jobId}", url: "jobs/{jobId}",


+ 2
- 1
Sevomin.WebFrontend/Global.asax.cs View File

@ -1,4 +1,5 @@
using System.Web.Mvc;
using Sevomin.Models;
using System.Web.Mvc;
using System.Web.Routing; using System.Web.Routing;
namespace Sevomin.WebFrontend namespace Sevomin.WebFrontend


+ 2
- 0
Sevomin.WebFrontend/Sevomin.WebFrontend.csproj View File

@ -260,6 +260,8 @@
<Content Include="Views\Home\AvalinIndex.cshtml" /> <Content Include="Views\Home\AvalinIndex.cshtml" />
<Content Include="Views\Job\JobList.cshtml" /> <Content Include="Views\Job\JobList.cshtml" />
<Content Include="Views\Job\SingleJob.cshtml" /> <Content Include="Views\Job\SingleJob.cshtml" />
<Content Include="Views\Job\Apply.cshtml" />
<Content Include="Views\Job\JobDigest.cshtml" />
<None Include="Web.Debug.config"> <None Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon> <DependentUpon>Web.config</DependentUpon>
</None> </None>


+ 27
- 0
Sevomin.WebFrontend/Views/Job/Apply.cshtml View File

@ -0,0 +1,27 @@
@model Sevomin.Models.DovominJobViewModel
@{
ViewBag.Title = ViewBag.ShortJobDescription;
}
@Html.Partial("PostResult", ViewBag.Result as Sevomin.Models.PostResultViewModel)
<div class="col-md-12 rtl">
<h4 class="rtl">@ViewBag.ShortJobDescription</h4>
@Html.Partial("JobDigest", (Sevomin.Models.JobViewModel)ViewBag.Job)
@using (Html.BeginForm("Apply", "Job", FormMethod.Post, new { role = "form" }))
{
@Html.AntiForgeryToken()
<div class="form-group">
@Html.LabelFor(model => model.CoverLetter)
<p>برای کارفرمای مربوطه پیغامی داری بگو</p>
@Html.TextAreaFor(model => model.CoverLetter, new { @class = "form-control" })
@Html.ValidationMessageFor(m => m.CoverLetter)
</div>
<div class="clearfix">
<button type="submit" class="btn btn-primary pull-left">اعلام آمادگی به کارفرما</button>
</div>
}
</div>

+ 2
- 0
Sevomin.WebFrontend/Views/Job/Edit.cshtml View File

@ -3,6 +3,8 @@
ViewBag.Title = "ویرایش آگهی استخدام"; ViewBag.Title = "ویرایش آگهی استخدام";
} }
@Html.Partial("PostResult", ViewBag.Result as Sevomin.Models.PostResultViewModel)
<div class="page-header rtl"> <div class="page-header rtl">
<h1>ویرایش آگهی استخدام <small>لورم ایپسوم</small></h1> <h1>ویرایش آگهی استخدام <small>لورم ایپسوم</small></h1>
</div> </div>


+ 43
- 0
Sevomin.WebFrontend/Views/Job/JobDigest.cshtml View File

@ -0,0 +1,43 @@
@model Sevomin.Models.JobViewModel
<div class="table-responsive rtl">
<table class="table table-bordered">
<thead>
<tr>
<th>@Html.DisplayNameFor(m => m.JalaliCreateDate)</th>
<th>@Html.DisplayNameFor(m => m.JalaliExpireDate)</th>
<th>@Html.DisplayNameFor(m => m.ResumeType)</th>
<th>@Html.DisplayNameFor(m => m.IsFullTime)</th>
</tr>
</thead>
<tbody>
<tr>
<td>@Html.DisplayFor(m => m.JalaliCreateDate)</td>
<td>@Html.DisplayFor(m => m.JalaliExpireDate)</td>
<td>@Sevomin.Models.Helpers.StringEnum.GetStringValue((Sevomin.Models.Enums.ResumeTypes)Model.ResumeType)</td>
<td>@(Model.IsFullTime ? "بله" : "خیر")</td>
</tr>
</tbody>
</table>
<table class="table table-stripped table-bordered">
<thead>
<tr>
<th colspan="2">ویژگی</th>
<th>میزان اهمیت</th>
</tr>
</thead>
<tbody>
@foreach (var param in Model.Parameters)
{
if (!string.IsNullOrWhiteSpace(param.StringValue))
{
<tr>
<th>@param.ParameterName</th>
<td>@(param.DisplayMethod == 4 ? param.ParameterValues.FirstOrDefault(v => v.Item1.ToString() == param.StringValue).Item2 : param.StringValue)</td>
<td>@Sevomin.Models.Helpers.StringEnum.GetStringValue((Sevomin.Models.Enums.MuSCoW)param.MoscowValue)</td>
</tr>
}
}
</tbody>
</table>
</div>

+ 4
- 1
Sevomin.WebFrontend/Views/Job/JobList.cshtml View File

@ -18,7 +18,10 @@
</p> </p>
<div class="job-list-bottom-toolbar rtl"> <div class="job-list-bottom-toolbar rtl">
<span class="date">آخرین مهلت اعلام آمادگی: @job.JalaliExpireDate</span> <span class="date">آخرین مهلت اعلام آمادگی: @job.JalaliExpireDate</span>
<a href="#" class="btn btn-primary btn-xs"><span class="glyphicon glyphicon-ok"></span> اعلام آمادگی</a>
@if (User.IsInRole("Dovomin"))
{
<a href="@Url.Action("Apply", "Job", new { jobId = job.Id })" class="btn btn-primary btn-xs"><span class="glyphicon glyphicon-ok"></span> اعلام آمادگی</a>
}
</div> </div>
</div> </div>
</div> </div>


+ 2
- 0
Sevomin.WebFrontend/Views/Job/NewJob.cshtml View File

@ -2,6 +2,8 @@
ViewBag.Title = "انتشار آگهی جدید"; ViewBag.Title = "انتشار آگهی جدید";
} }
@Html.Partial("PostResult", ViewBag.Result as Sevomin.Models.PostResultViewModel)
<div class="page-header rtl"> <div class="page-header rtl">
<h1>انتشار آگهی استخدام <small>لورم ایپسوم</small></h1> <h1>انتشار آگهی استخدام <small>لورم ایپسوم</small></h1>
</div> </div>


+ 6
- 3
Sevomin.WebFrontend/Views/Job/SingleJob.cshtml View File

@ -10,9 +10,12 @@
<h4 class="rtl">@ViewBag.ShortJobDescription</h4> <h4 class="rtl">@ViewBag.ShortJobDescription</h4>
<div class="table-responsive rtl"> <div class="table-responsive rtl">
<p>
<a class="btn btn-primary btn-xs" href="#"><span class="glyphicon glyphicon-ok"></span>اعلام آمادگی</a>
</p>
@if (User.IsInRole("Dovomin"))
{
<p>
<a class="btn btn-primary btn-xs" href="@Url.Action("Apply", "Job", new { jobId = Model.Id })"><span class="glyphicon glyphicon-ok"></span> اعلام آمادگی</a>
</p>
}
<table class="table table-bordered"> <table class="table table-bordered">
<thead> <thead>
<tr> <tr>


+ 13
- 3
Sevomin.WebFrontend/Web.config View File

@ -6,7 +6,8 @@
<configuration> <configuration>
<configSections> <configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections> </configSections>
<!--<entityFramework> <!--<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
@ -18,7 +19,6 @@
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/> <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
</providers> </providers>
</entityFramework>--> </entityFramework>-->
<connectionStrings> <connectionStrings>
<clear /> <clear />
<add name="UsersConnectionString" connectionString="Data Source=codiato;Initial Catalog=Sevomin;Integrated Security=True;Pooling=False" providerName="System.Data.SqlClient" /> <add name="UsersConnectionString" connectionString="Data Source=codiato;Initial Catalog=Sevomin;Integrated Security=True;Pooling=False" providerName="System.Data.SqlClient" />
@ -74,4 +74,14 @@
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
</configuration>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>

+ 0
- 5
Sevomin.sln View File

@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012 # Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sevomin.WebFrontend", "Sevomin.WebFrontend\Sevomin.WebFrontend.csproj", "{95C7D295-0E5E-43EB-AD46-8CED0B9FDB2F}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sevomin.WebFrontend", "Sevomin.WebFrontend\Sevomin.WebFrontend.csproj", "{95C7D295-0E5E-43EB-AD46-8CED0B9FDB2F}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Controllers", "Controllers", "{9371666D-949F-4978-824B-AC8C396A8720}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sevomin.WebFrontend.Controllers", "Sevomin.WebFrontend.Controllers\Sevomin.WebFrontend.Controllers.csproj", "{1E1E197B-9300-4512-98CB-B1B8AAB75964}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sevomin.WebFrontend.Controllers", "Sevomin.WebFrontend.Controllers\Sevomin.WebFrontend.Controllers.csproj", "{1E1E197B-9300-4512-98CB-B1B8AAB75964}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sevomin.Models", "Sevomin.Models\Sevomin.Models.csproj", "{CB5D89BC-10D1-44D6-857B-A94B5CFCFB11}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sevomin.Models", "Sevomin.Models\Sevomin.Models.csproj", "{CB5D89BC-10D1-44D6-857B-A94B5CFCFB11}"
@ -37,7 +35,4 @@ Global
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{1E1E197B-9300-4512-98CB-B1B8AAB75964} = {9371666D-949F-4978-824B-AC8C396A8720}
EndGlobalSection
EndGlobal EndGlobal

Loading…
Cancel
Save