Browse Source

Initial Ad stuffs

master
Mehrdadmaskull 10 years ago
parent
commit
c59c85be14
19 changed files with 588 additions and 633 deletions
  1. +26
    -0
      Sevomin.Models/Ad.cs
  2. +60
    -0
      Sevomin.Models/AdViewModel.cs
  3. +0
    -29
      Sevomin.Models/Migrations/201503030741121_Init.Designer.cs
  4. +0
    -268
      Sevomin.Models/Migrations/201503030741121_Init.cs
  5. +0
    -126
      Sevomin.Models/Migrations/201503030741121_Init.resx
  6. +0
    -126
      Sevomin.Models/Migrations/201503091139500_Init.resx
  7. +1
    -1
      Sevomin.Models/Migrations/201503101336488_Init.Designer.cs
  8. +16
    -0
      Sevomin.Models/Migrations/201503101336488_Init.cs
  9. +126
    -0
      Sevomin.Models/Migrations/201503101336488_Init.resx
  10. +74
    -0
      Sevomin.Models/Repositories/AdRepository.cs
  11. +7
    -0
      Sevomin.Models/Repositories/IRepository.cs
  12. +8
    -5
      Sevomin.Models/Sevomin.Models.csproj
  13. +1
    -0
      Sevomin.Models/SevominDbContext.cs
  14. +29
    -0
      Sevomin.WebFrontend.Controllers/AdsController.cs
  15. +43
    -0
      Sevomin.WebFrontend.Controllers/GodController.cs
  16. +5
    -0
      Sevomin.WebFrontend.Controllers/Sevomin.WebFrontend.Controllers.csproj
  17. +1
    -0
      Sevomin.WebFrontend/Sevomin.WebFrontend.csproj
  18. +73
    -0
      Sevomin.WebFrontend/Views/God/AdManagementPanel.cshtml
  19. +118
    -78
      Sevomin.WebFrontend/Views/God/Index.cshtml

+ 26
- 0
Sevomin.Models/Ad.cs View File

@ -0,0 +1,26 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Sevomin.Models
{
public class Ad
{
[Key]
public long Id { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public int Duration { get; set; }
public long ClickCount { get; set; }
public string Link { get; set; }
public DateTime CreatedDate { get; set; }
public bool Active { get; set; }
[NotMapped]
public bool Expired
{
get { return (CreatedDate.AddDays(Duration) < DateTime.Now); }
}
}
}

+ 60
- 0
Sevomin.Models/AdViewModel.cs View File

@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sevomin.Models.Helpers;
namespace Sevomin.Models
{
class AdViewModel
{
[Key]
public long Id { get; set; }
[DisplayName("عنوان")]
[Required(ErrorMessage = "{0} را وارد کنید")]
public string Title { get; set; }
[Required(ErrorMessage = "{0} را وارد کنید")]
[DisplayName("متن")]
public string Description { get; set; }
[Required(ErrorMessage = "{0} را وارد کنید")]
[DisplayName("تعداد روز")]
public int Duration { get; set; }
[DisplayName("تعداد کلیک")]
public long ClickCount { get; set; }
[DisplayName("لینک")]
[Required(ErrorMessage = "{0} را وارد کنید")]
public string Link { get; set; }
[DisplayName("تاریخ ساخته شدن")]
public DateTime CreatedDate { get; set; }
[DisplayName("فعال")]
public bool Active { get; set; }
[NotMapped]
public bool Expired
{
get { return (CreatedDate.AddDays(Duration) < DateTime.Now); }
}
public AdViewModel(Ad ad)
{
Id = ad.Id;
Duration = ad.Duration;
Link = ad.Link;
ClickCount = ad.ClickCount;
CreatedDate = ad.CreatedDate;
Title = ad.Title;
Description = ad.Description;
}
}
}

+ 0
- 29
Sevomin.Models/Migrations/201503030741121_Init.Designer.cs View File

@ -1,29 +0,0 @@
// <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 Init : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(Init));
string IMigrationMetadata.Id
{
get { return "201503030741121_Init"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

+ 0
- 268
Sevomin.Models/Migrations/201503030741121_Init.cs View File

@ -1,268 +0,0 @@
namespace Sevomin.Models.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class Init : 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),
ParameterType = 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(),
OptOutEmail = c.Boolean(nullable: false),
})
.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");
}
}
}

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


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


Sevomin.Models/Migrations/201503091139500_Init.Designer.cs → Sevomin.Models/Migrations/201503101336488_Init.Designer.cs View File


Sevomin.Models/Migrations/201503091139500_Init.cs → Sevomin.Models/Migrations/201503101336488_Init.cs View File


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


+ 74
- 0
Sevomin.Models/Repositories/AdRepository.cs View File

@ -0,0 +1,74 @@
using System.Linq;
namespace Sevomin.Models.Repositories
{
public class AdRepository : IAdRepository
{
#region Singleton
private static AdRepository member;
private static object locker = new object();
private AdRepository()
{
}
static AdRepository()
{
lock (locker)
{
member = new AdRepository();
}
}
public static AdRepository Current
{
get
{
return member;
}
}
#endregion
#region AdRepository
public IQueryable<Ad> ListAll()
{
return SevominDbContext.Current.Ads;
}
public void Add(Ad entity)
{
SevominDbContext.Current.Ads.Add(entity);
Save();
}
public void Delete(Ad entity)
{
SevominDbContext.Current.Ads.Remove(entity);
Save();
}
public Ad Find(long key)
{
return ListAll().SingleOrDefault(m => m.Id == key);
}
public void Save()
{
SevominDbContext.Current.SaveChanges();
}
public void ChangeDays(Ad ad, int duration)
{
SevominDbContext.Current.Ads.Find(ad).Duration = duration;
Save();
}
public void ToggleActive(Ad ad)
{
SevominDbContext.Current.Ads.Find(ad).Active = !SevominDbContext.Current.Ads.Find(ad).Active;
Save();
}
#endregion
}
}

+ 7
- 0
Sevomin.Models/Repositories/IRepository.cs View File

@ -28,4 +28,11 @@ namespace Sevomin.Models.Repositories
IQueryable<Parameter> ListAll(); IQueryable<Parameter> ListAll();
void AddParametersToDovomin(Dovomin dovomin); void AddParametersToDovomin(Dovomin dovomin);
} }
public interface IAdRepository : IRepository<long, Ad>
{
void ChangeDays(Ad ad, int duration);
void ToggleActive(Ad ad);
IQueryable<Ad> ListAll();
}
} }

+ 8
- 5
Sevomin.Models/Sevomin.Models.csproj View File

@ -83,6 +83,8 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Ad.cs" />
<Compile Include="AdViewModel.cs" />
<Compile Include="Avalin.cs" /> <Compile Include="Avalin.cs" />
<Compile Include="AvalinViewModel.cs" /> <Compile Include="AvalinViewModel.cs" />
<Compile Include="ChangePasswordViewModel.cs" /> <Compile Include="ChangePasswordViewModel.cs" />
@ -91,11 +93,12 @@
<Compile Include="Helpers\ScheduledTasks\NewJob.cs" /> <Compile Include="Helpers\ScheduledTasks\NewJob.cs" />
<Compile Include="Helpers\ScheduledTasks\NewApplication.cs" /> <Compile Include="Helpers\ScheduledTasks\NewApplication.cs" />
<Compile Include="JobMiniExternalViewModel.cs" /> <Compile Include="JobMiniExternalViewModel.cs" />
<Compile Include="Migrations\201503091139500_Init.cs" />
<Compile Include="Migrations\201503091139500_Init.Designer.cs">
<DependentUpon>201503091139500_Init.cs</DependentUpon>
<Compile Include="Migrations\201503101336488_Init.cs" />
<Compile Include="Migrations\201503101336488_Init.Designer.cs">
<DependentUpon>201503101336488_Init.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Migrations\Configuration.cs" /> <Compile Include="Migrations\Configuration.cs" />
<Compile Include="Repositories\AdRepository.cs" />
<Compile Include="ResetPasswordViewModel.cs" /> <Compile Include="ResetPasswordViewModel.cs" />
<Compile Include="ForgotPasswordViewModel.cs" /> <Compile Include="ForgotPasswordViewModel.cs" />
<Compile Include="DovominJob.cs" /> <Compile Include="DovominJob.cs" />
@ -137,8 +140,8 @@
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Migrations\201503091139500_Init.resx">
<DependentUpon>201503091139500_Init.cs</DependentUpon>
<EmbeddedResource Include="Migrations\201503101336488_Init.resx">
<DependentUpon>201503101336488_Init.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />


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

@ -42,5 +42,6 @@ namespace Sevomin.Models
public DbSet<ParameterValue> ParameterValues { get; set; } public DbSet<ParameterValue> ParameterValues { get; set; }
public DbSet<Job> Jobs { get; set; } public DbSet<Job> Jobs { get; set; }
public DbSet<DovominJob> DovominJobs { get; set; } public DbSet<DovominJob> DovominJobs { get; set; }
public DbSet<Ad> Ads { get; set; }
} }
} }

+ 29
- 0
Sevomin.WebFrontend.Controllers/AdsController.cs View File

@ -0,0 +1,29 @@
using System.Linq;
using System.Web.Mvc;
using Sevomin.Models.Repositories;
namespace Sevomin.WebFrontend.Controllers
{
class AdsController : Controller
{
IAdRepository _adRepository;
public AdsController() : this(AdRepository.Current)
{
}
public AdsController(IAdRepository adRepository)
{
_adRepository = adRepository;
}
public ActionResult Ads(int id)
{
var ad = _adRepository.ListAll().SingleOrDefault(m => m.Id == id);
if (ad == null)
{
return HttpNotFound();
}
return Redirect(ad.Link);
}
}
}

+ 43
- 0
Sevomin.WebFrontend.Controllers/GodController.cs View File

@ -9,11 +9,23 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web.Mvc; using System.Web.Mvc;
using Sevomin.Models.Repositories;
namespace Sevomin.WebFrontend.Controllers namespace Sevomin.WebFrontend.Controllers
{ {
public class GodController : AuthorizedController public class GodController : AuthorizedController
{ {
IAdRepository _adRepository;
public GodController() : this(AdRepository.Current)
{
}
public GodController(IAdRepository adRepository)
{
_adRepository = adRepository;
}
[Authorize(Roles = "God")] [Authorize(Roles = "God")]
public ActionResult Index() public ActionResult Index()
{ {
@ -70,5 +82,36 @@ namespace Sevomin.WebFrontend.Controllers
} }
} }
[Authorize(Roles = "God")]
public ActionResult AdManagementPanel()
{
var model = _adRepository.ListAll();
return View(model);
}
[Authorize(Roles = "God")]
public ActionResult ChangeDays(long id, FormCollection form)
{
var ad = _adRepository.ListAll().SingleOrDefault(m => m.Id == id);
if (ad == null)
{
throw new NullReferenceException();
}
_adRepository.ChangeDays(ad, Convert.ToInt32(form["ChangeDays"]));
return RedirectToAction("Index");
}
[Authorize(Roles = "God")]
public ActionResult ToggleAd(long id)
{
var ad = _adRepository.ListAll().SingleOrDefault(m => m.Id == id);
if (ad == null)
{
throw new NullReferenceException();
}
_adRepository.ToggleActive(ad);
return RedirectToAction("Index");
}
} }
} }

+ 5
- 0
Sevomin.WebFrontend.Controllers/Sevomin.WebFrontend.Controllers.csproj View File

@ -85,6 +85,10 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.0.0\lib\net45\System.Web.Mvc.dll</HintPath> <HintPath>..\packages\Microsoft.AspNet.Mvc.5.0.0\lib\net45\System.Web.Mvc.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.1.1\lib\net45\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
@ -93,6 +97,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AccountController.cs" /> <Compile Include="AccountController.cs" />
<Compile Include="AdsController.cs" />
<Compile Include="AuthorizedController.cs" /> <Compile Include="AuthorizedController.cs" />
<Compile Include="BaseController.cs" /> <Compile Include="BaseController.cs" />
<Compile Include="GodController.cs" /> <Compile Include="GodController.cs" />


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

@ -339,6 +339,7 @@
<Content Include="Views\God\Index.cshtml" /> <Content Include="Views\God\Index.cshtml" />
<Content Include="Views\Help\ExportScript.cshtml" /> <Content Include="Views\Help\ExportScript.cshtml" />
<Content Include="Views\Help\ExportRss.cshtml" /> <Content Include="Views\Help\ExportRss.cshtml" />
<Content Include="Views\God\AdManagementPanel.cshtml" />
<None Include="Web.Debug.config"> <None Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon> <DependentUpon>Web.config</DependentUpon>
</None> </None>


+ 73
- 0
Sevomin.WebFrontend/Views/God/AdManagementPanel.cshtml View File

@ -0,0 +1,73 @@
@model IQueryable<Sevomin.Models.Ad>
@if (Model.Any())
{
<div class="row">
<div class="col-md-12 rtl">
<div class="panel panel-default" id="ad-management-panel">
<div class="panel-heading">
<h4 class="panel-title"><a data-toggle="collapse" data-parent="ad-management-panel" href="#ad-management-panel-body">ویرایش متن راهنمای پارامترها</a></h4>
</div>
<div id="ad-management-panel-body" class="panel-collapse collapse in">
<div class="panel-body">
<div class="panel-heading">
<div class="panel-title">
آگهی های فعال
</div>
</div>
<div class="panel-body">
<ul>
@foreach (var ad in Model.Where(m => m.Active))
{
<li>
<div class="col-md-6">
@ad.Title
</div>
<div class="col-md-2">
<input type="number" placeholder="تغییر روز" name="ChangeDays" value="@ad.Duration" />
</div>
<div class="col-md-2">
<button type="submit" class="btn btn-success">
<a href="@Url.Action("ChangeDays", new { id = ad.Id })">تغییر روز</a>
</button>
</div>
<div class="col-md-2">
<button type="submit" class="btn btn-default">
<a href="@Url.Action("ToggleAd", new { id = ad.Id })">غیر فعالسازی</a>
</button>
</div>
</li>
}
</ul>
</div>
<div class="panel-heading">
<div class="panel-title">
آگهی های غیر فعال
</div>
</div>
<div class="panel-body">
<ul>
@foreach (var ad in Model.Where(m => !m.Active))
{
<li>
<div class="col-md-3">
@ad.Title
</div>
<div class="col-md-7">
@ad.Description
</div>
<div class="col-md-2">
<button type="submit" class="btn btn-default">
<a href="@Url.Action("ToggleAd", new { id = ad.Id })">فعالسازی</a>
</button>
</div>
</li>
}
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
}

+ 118
- 78
Sevomin.WebFrontend/Views/God/Index.cshtml View File

@ -55,22 +55,22 @@
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-stripped table-bordered"> <table class="table table-stripped table-bordered">
<thead> <thead>
<tr>
<th>تعداد کل اعضا</th>
<th>تعداد کارفرماها</th>
<th>تعداد متخصصین</th>
<th>تعداد فرصت های شغلی</th>
<th>تعداد اعلام آمادگی های فرصت های شغلی</th>
</tr>
<tr>
<th>تعداد کل اعضا</th>
<th>تعداد کارفرماها</th>
<th>تعداد متخصصین</th>
<th>تعداد فرصت های شغلی</th>
<th>تعداد اعلام آمادگی های فرصت های شغلی</th>
</tr>
</thead> </thead>
<tbody> <tbody>
<tr>
<td>@Sevomin.Models.SevominDbContext.Current.Users.Count() (دو روز اخیر: @Sevomin.Models.SevominDbContext.Current.Users.ToList().Where(u => u.SignUpDate.Date > DateTime.Now.Date.AddDays(-2)).Count())</td>
<td>@(Sevomin.Models.SevominDbContext.Current.Users.OfType<Sevomin.Models.Avalin>().Count()) (دو روز اخیر: @(Sevomin.Models.SevominDbContext.Current.Users.OfType<Sevomin.Models.Avalin>().ToList().Where(u => u.SignUpDate.Date > DateTime.Now.Date.AddDays(-2)).Count()))</td>
<td>@(Sevomin.Models.SevominDbContext.Current.Users.OfType<Sevomin.Models.Dovomin>().Count()) (دو روز اخیر: @(Sevomin.Models.SevominDbContext.Current.Users.OfType<Sevomin.Models.Dovomin>().ToList().Where(u => u.SignUpDate.Date > DateTime.Now.Date.AddDays(-2)).Count()))</td>
<td>@Sevomin.Models.SevominDbContext.Current.Jobs.Count()</td>
<td>@Sevomin.Models.SevominDbContext.Current.DovominJobs.Count() (دو روز اخیر: @Sevomin.Models.SevominDbContext.Current.DovominJobs.ToList().Where(j => j.ApplyDate.Date > DateTime.Now.Date.AddDays(-2)).Count())</td>
</tr>
<tr>
<td>@Sevomin.Models.SevominDbContext.Current.Users.Count() (دو روز اخیر: @Sevomin.Models.SevominDbContext.Current.Users.ToList().Where(u => u.SignUpDate.Date > DateTime.Now.Date.AddDays(-2)).Count())</td>
<td>@(Sevomin.Models.SevominDbContext.Current.Users.OfType<Sevomin.Models.Avalin>().Count()) (دو روز اخیر: @(Sevomin.Models.SevominDbContext.Current.Users.OfType<Sevomin.Models.Avalin>().ToList().Where(u => u.SignUpDate.Date > DateTime.Now.Date.AddDays(-2)).Count()))</td>
<td>@(Sevomin.Models.SevominDbContext.Current.Users.OfType<Sevomin.Models.Dovomin>().Count()) (دو روز اخیر: @(Sevomin.Models.SevominDbContext.Current.Users.OfType<Sevomin.Models.Dovomin>().ToList().Where(u => u.SignUpDate.Date > DateTime.Now.Date.AddDays(-2)).Count()))</td>
<td>@Sevomin.Models.SevominDbContext.Current.Jobs.Count()</td>
<td>@Sevomin.Models.SevominDbContext.Current.DovominJobs.Count() (دو روز اخیر: @Sevomin.Models.SevominDbContext.Current.DovominJobs.ToList().Where(j => j.ApplyDate.Date > DateTime.Now.Date.AddDays(-2)).Count())</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
@ -78,10 +78,43 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12 rtl"> <div class="col-md-12 rtl">
<div class="panel panel-default">
<div class="panel panel-default" id="ad-panel">
<div class="panel-heading"> <div class="panel-heading">
<h4 class="panel-title"><a data-toggle="collapse" data-parent="ad-panel" href="#ad-panel-body">اضافه کردن آگهی در منوی کناری</a></h4> <h4 class="panel-title"><a data-toggle="collapse" data-parent="ad-panel" href="#ad-panel-body">اضافه کردن آگهی در منوی کناری</a></h4>
</div> </div>
<div id="ad-panel-body" class="panel-collapse collapse in">
<div class="panel-body">
<div class="row">
<div class="col-md-8 pull-right">
<label class="col-md-2 pull-right">
عنوان
</label>
<input type="text" name="Title" placeholder="عنوان" class="col-md-10 pull-left" />
</div>
<div class="col-md-3 pull-left">
<label class='col-md-6 pull-right'>
مدت
</label>
<input type="number" name="Duration" placeholder="مدت" class="col-md-6 pull-left" />
</div>
</div>
<div class="row">
<div class="col-md-12">
<label class="col-md-2 pull-right">متن</label>
<input type="text" name="Description" placeholder="متن" class="col-md-8 col-md-offset-1 pull-left" />
</div>
</div>
<div class="row">
<div class="col-md-9 pull-right">
<label class='col-md-2 pull-right'>لینک</label>
<input type="text" name="Link" placeholder="لینک" class="col-md-10 pull-left" />
</div>
<div class="col-md-3">
<button class="btn btn-default" type="submit" role="button">درج آگهی</button>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -98,25 +131,25 @@
<div class="col-md-6 col-sm-12 col-xs-12"> <div class="col-md-6 col-sm-12 col-xs-12">
<table class="table table-stripped table-bordered"> <table class="table table-stripped table-bordered">
<thead> <thead>
<tr>
<th>پارامتر</th>
<th>توضیح اولین</th>
<th>توضیح دومین</th>
</tr>
<tr>
<th>پارامتر</th>
<th>توضیح اولین</th>
<th>توضیح دومین</th>
</tr>
</thead> </thead>
<tbody> <tbody>
<tr>
<td>@param.Name</td>
<td>
<div style="border: 1px solid #dcdcdc" data-param-id="@param.Id" data-id="CommentAvalin" contenteditable>@param.CommentAvalin</div>
</td>
<td>
<div style="border: 1px solid #dcdcdc" data-param-id="@param.Id" data-id="CommentDovomin" contenteditable>@param.CommentDovomin</div>
</td>
<td>
<button data-param-id="@param.Id" class="btn btn-xs btn-primary pull-left parameter-updater"><span class="glyphicon glyphicon-refresh"></span></button>
</td>
</tr>
<tr>
<td>@param.Name</td>
<td>
<div style="border: 1px solid #dcdcdc" data-param-id="@param.Id" data-id="CommentAvalin" contenteditable>@param.CommentAvalin</div>
</td>
<td>
<div style="border: 1px solid #dcdcdc" data-param-id="@param.Id" data-id="CommentDovomin" contenteditable>@param.CommentDovomin</div>
</td>
<td>
<button data-param-id="@param.Id" class="btn btn-xs btn-primary pull-left parameter-updater"><span class="glyphicon glyphicon-refresh"></span></button>
</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
@ -131,60 +164,65 @@
<h2>اعلام آمادگی های فرصت های شغلی</h2> <h2>اعلام آمادگی های فرصت های شغلی</h2>
<div class="panel-group" id="accordion"> <div class="panel-group" id="accordion">
@foreach (Sevomin.Models.Avalin avalin in Sevomin.Models.SevominDbContext.Current.Users.OfType<Sevomin.Models.Avalin>().ToList() @foreach (Sevomin.Models.Avalin avalin in Sevomin.Models.SevominDbContext.Current.Users.OfType<Sevomin.Models.Avalin>().ToList()
.Where(a => a.Jobs != null && a.Jobs.Any(j => j.ExpireDate.Date >= DateTime.Now.Date))
.OrderByDescending(a => a.Jobs.OrderByDescending(j => j.CreateDate).First().CreateDate)
.ToList())
.Where(a => a.Jobs != null && a.Jobs.Any(j => j.ExpireDate.Date >= DateTime.Now.Date))
.OrderByDescending(a => a.Jobs.OrderByDescending(j => j.CreateDate).First().CreateDate)
.ToList())
{
if (avalin.Jobs.Count == 0)
{
continue;
}
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#@avalin.Id">
@avalin.DisplayName
</a>
</h4>
</div>
@foreach (var job in avalin.Jobs.OrderByDescending(a => a.CreateDate))
{ {
if (avalin.Jobs.Count == 0)
{ continue; }
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#@avalin.Id">
@avalin.DisplayName
</a>
</h4>
</div>
@foreach (var job in avalin.Jobs.OrderByDescending(a => a.CreateDate))
if (job.Applications.Count == 0)
{
continue;
}
<div id="@avalin.Id" class="panel-collapse collapse in">
<div class="panel-body">
<p>@((new Sevomin.Models.JobMiniViewModel(job)).JobSummary) @Html.ActionLink("مشاهده آگهی", "SingleJob", "Job", new {jobId = job.Id}, null)</p>
<h5>
اطلاعات فرد پاسخگو به این آگهی: (@(string.IsNullOrWhiteSpace(job.ContactPersonName) ? "نام وارد نشده" : job.ContactPersonName)
@((string.IsNullOrWhiteSpace(job.ContactPersonEMail) ? "ایمیل وارد نشده" : job.ContactPersonEMail))
@((string.IsNullOrWhiteSpace(job.ContactPersonPhone) ? "تلفن وارد نشده" : job.ContactPersonPhone)))
</h5>
</div>
@foreach (var application in job.Applications.OrderByDescending(a => a.ApplyDate))
{ {
if (job.Applications.Count == 0)
{ continue; }
<div id="@avalin.Id" class="panel-collapse collapse in">
<div class="panel-body">
<p>@((new Sevomin.Models.JobMiniViewModel(job)).JobSummary) @Html.ActionLink("مشاهده آگهی", "SingleJob", "Job", new { jobId = job.Id }, null)</p>
<h5>
اطلاعات فرد پاسخگو به این آگهی: (@(string.IsNullOrWhiteSpace(job.ContactPersonName) ? "نام وارد نشده" : job.ContactPersonName)
@((string.IsNullOrWhiteSpace(job.ContactPersonEMail) ? "ایمیل وارد نشده" : job.ContactPersonEMail))
@((string.IsNullOrWhiteSpace(job.ContactPersonPhone) ? "تلفن وارد نشده" : job.ContactPersonPhone)))
</h5>
</div>
@foreach (var application in job.Applications.OrderByDescending(a => a.ApplyDate))
Sevomin.Models.JobApplicationViewModel apply = new Sevomin.Models.JobApplicationViewModel(application);
<div class="panel-body">
<em>از طرف <a href="@Url.Action("Dovomin", "Account", new {userId = apply.DovominId})">@apply.DovominDisplayName</a></em>
@if (!string.IsNullOrWhiteSpace(apply.CoverLetter))
{ {
Sevomin.Models.JobApplicationViewModel apply = new Sevomin.Models.JobApplicationViewModel(application);
<div class="panel-body">
<em>از طرف <a href="@Url.Action("Dovomin", "Account", new { userId = apply.DovominId })">@apply.DovominDisplayName</a></em>
@if (!string.IsNullOrWhiteSpace(apply.CoverLetter))
{
<h5>پیغام متخصص:</h5>
<blockquote>@apply.CoverLetter</blockquote>
}
@if (apply.MinimumRequirement)
{
<p>این متخصص تمامی مهارت های الزامی برای این فرصت شغلی را دارد. همچنین میزان مطابقت ایشان با این فرصت شغلی، @apply.Affinity درصد است.</p>
}
else
{
<p>این متخصص برخی مهارت های الزامی برای این فرصت شغلی را ندارد. همچنین میزان مطابقت ایشان با این فرصت شغلی، @apply.Affinity درصد است.</p>
}
</div>
<h5>پیغام متخصص:</h5>
<blockquote>@apply.CoverLetter</blockquote>
} }
</div>
@if (apply.MinimumRequirement)
{
<p>این متخصص تمامی مهارت های الزامی برای این فرصت شغلی را دارد. همچنین میزان مطابقت ایشان با این فرصت شغلی، @apply.Affinity درصد است.</p>
}
else
{
<p>این متخصص برخی مهارت های الزامی برای این فرصت شغلی را ندارد. همچنین میزان مطابقت ایشان با این فرصت شغلی، @apply.Affinity درصد است.</p>
}
</div>
} }
</div>
</div>
} }
</div>
}
</div> </div>
</div> </div>
</div> </div>
@Html.Action("AdManagementPanel")
</div> </div>
<script src="@Url.Content("~/scripts/jquery-2.1.0.min.js")"></script> <script src="@Url.Content("~/scripts/jquery-2.1.0.min.js")"></script>
<script src="@Url.Content("~/scripts/jquery-ui-1.10.4.js")"></script> <script src="@Url.Content("~/scripts/jquery-ui-1.10.4.js")"></script>
@ -200,7 +238,9 @@
$('button.parameter-updater').bind('click', function (e) { $('button.parameter-updater').bind('click', function (e) {
e.preventDefault(); e.preventDefault();
var vals = $('div[data-param-id="' + $(this).data('param-id') + '"]'); var vals = $('div[data-param-id="' + $(this).data('param-id') + '"]');
var commentAvalin; var commentDovomin; var paramId = $(this).data('param-id');
var commentAvalin;
var commentDovomin;
var paramId = $(this).data('param-id');
$.each(vals, function (index, obj) { $.each(vals, function (index, obj) {
if ($(obj).data('id') == "CommentAvalin") if ($(obj).data('id') == "CommentAvalin")
commentAvalin = $(obj).text(); commentAvalin = $(obj).text();


Loading…
Cancel
Save