Browse Source

Ads done

master
Mehrdadmaskull 10 years ago
parent
commit
5fd093b3d8
13 changed files with 248 additions and 194 deletions
  1. +0
    -5
      Sevomin.Models/AdViewModel.cs
  2. +12
    -5
      Sevomin.Models/Repositories/AdRepository.cs
  3. +5
    -3
      Sevomin.Models/Repositories/IRepository.cs
  4. +2
    -2
      Sevomin.WebFrontend.Controllers/AccountController.cs
  5. +0
    -29
      Sevomin.WebFrontend.Controllers/AdsController.cs
  6. +16
    -8
      Sevomin.WebFrontend.Controllers/GodController.cs
  7. +25
    -14
      Sevomin.WebFrontend.Controllers/HomeController.cs
  8. +7
    -3
      Sevomin.WebFrontend.Controllers/JobController.cs
  9. +0
    -1
      Sevomin.WebFrontend.Controllers/Sevomin.WebFrontend.Controllers.csproj
  10. +3
    -2
      Sevomin.WebFrontend/App_Start/RouteConfig.cs
  11. +44
    -26
      Sevomin.WebFrontend/Views/God/AdManagementPanel.cshtml
  12. +106
    -94
      Sevomin.WebFrontend/Views/God/Index.cshtml
  13. +28
    -2
      Sevomin.WebFrontend/Views/Job/JobList.cshtml

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

@ -1,12 +1,7 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
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
{ {


+ 12
- 5
Sevomin.Models/Repositories/AdRepository.cs View File

@ -1,4 +1,6 @@
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace Sevomin.Models.Repositories namespace Sevomin.Models.Repositories
{ {
@ -57,18 +59,23 @@ namespace Sevomin.Models.Repositories
SevominDbContext.Current.SaveChanges(); SevominDbContext.Current.SaveChanges();
} }
public void ChangeDays(Ad ad, int duration)
public void ChangeDays(long id, int duration)
{ {
SevominDbContext.Current.Ads.Find(ad).Duration = duration;
Find(id).Duration = duration;
Save(); Save();
} }
public void ToggleActive(Ad ad)
public void ToggleActive(long id)
{ {
SevominDbContext.Current.Ads.Find(ad).Active = !SevominDbContext.Current.Ads.Find(ad).Active;
Find(id).Active = !Find(id).Active;
Save(); Save();
} }
public IEnumerable<Ad> GetAds()
{
return ListAll().AsEnumerable().Where(m => m.Active && m.Expired == false);
}
#endregion #endregion
} }
} }

+ 5
- 3
Sevomin.Models/Repositories/IRepository.cs View File

@ -1,4 +1,5 @@
using System.Linq;
using System.Collections.Generic;
using System.Linq;
namespace Sevomin.Models.Repositories namespace Sevomin.Models.Repositories
{ {
@ -31,8 +32,9 @@ namespace Sevomin.Models.Repositories
public interface IAdRepository : IRepository<long, Ad> public interface IAdRepository : IRepository<long, Ad>
{ {
void ChangeDays(Ad ad, int duration);
void ToggleActive(Ad ad);
void ChangeDays(long id, int duration);
void ToggleActive(long id);
IQueryable<Ad> ListAll(); IQueryable<Ad> ListAll();
IEnumerable<Ad> GetAds();
} }
} }

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

@ -108,8 +108,8 @@ namespace Sevomin.WebFrontend.Controllers
if (Request.IsAuthenticated && User.Identity.Name.ToLower() != user.UserName.ToLower()) if (Request.IsAuthenticated && User.Identity.Name.ToLower() != user.UserName.ToLower())
{ {
ViewBag.Result = new PostResultViewModel(false, ViewBag.Result = new PostResultViewModel(false,
string.Format("شما با نام کاربری {0} در سایت وارد شده اید. نمی توانید حساب کاربری {1} را تایید نمایید.",
User.Identity.Name, user.UserName));
string.Format("شما نمیتوانید با حساب کاربری {0} حساب دیگری را فعال کنید",
User.Identity.Name));
return View(); return View();
} }


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

@ -1,29 +0,0 @@
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);
}
}
}

+ 16
- 8
Sevomin.WebFrontend.Controllers/GodController.cs View File

@ -82,6 +82,14 @@ namespace Sevomin.WebFrontend.Controllers
} }
} }
[Authorize(Roles = "God")]
public ActionResult AddAd(int duration, string link, string title, string description)
{
var ad = new Ad { Active = true, CreatedDate = DateTime.Now, Description = description, Link = link, Duration = duration, Title = title };
_adRepository.Add(ad);
return RedirectToAction("Index");
}
[Authorize(Roles = "God")] [Authorize(Roles = "God")]
public ActionResult AdManagementPanel() public ActionResult AdManagementPanel()
{ {
@ -89,29 +97,29 @@ namespace Sevomin.WebFrontend.Controllers
return View(model); return View(model);
} }
[HttpPost]
[Authorize(Roles = "God")] [Authorize(Roles = "God")]
public ActionResult ChangeDays(long id, FormCollection form)
public ActionResult ChangeDays(long id, int days)
{ {
var ad = _adRepository.ListAll().SingleOrDefault(m => m.Id == id);
var ad = _adRepository.Find(id);
if (ad == null) if (ad == null)
{ {
throw new NullReferenceException(); throw new NullReferenceException();
} }
_adRepository.ChangeDays(ad, Convert.ToInt32(form["ChangeDays"]));
return RedirectToAction("Index");
_adRepository.ChangeDays(id, days);
return RedirectToAction("Index", "God");
} }
[Authorize(Roles = "God")] [Authorize(Roles = "God")]
public ActionResult ToggleAd(long id) public ActionResult ToggleAd(long id)
{ {
var ad = _adRepository.ListAll().SingleOrDefault(m => m.Id == id);
var ad = _adRepository.Find(id);
if (ad == null) if (ad == null)
{ {
throw new NullReferenceException(); throw new NullReferenceException();
} }
_adRepository.ToggleActive(ad);
return RedirectToAction("Index");
_adRepository.ToggleActive(id);
return RedirectToAction("Index", "God");
} }
} }
} }

+ 25
- 14
Sevomin.WebFrontend.Controllers/HomeController.cs View File

@ -1,20 +1,25 @@
using Microsoft.AspNet.Identity.EntityFramework;
using System.Linq;
using Microsoft.AspNet.Identity.EntityFramework;
using Sevomin.Models; using Sevomin.Models;
using Sevomin.Models.Helpers; using Sevomin.Models.Helpers;
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 HomeController : BaseController public class HomeController : BaseController
{ {
IAdRepository _adRepository;
public HomeController() public HomeController()
: this(new SevominUserManager(new UserStore<User>(SevominDbContext.Current)))
: this(AdRepository.Current, new SevominUserManager(new UserStore<User>(SevominDbContext.Current)))
{ {
} }
public HomeController(SevominUserManager userManager)
public HomeController(IAdRepository adRepositry, SevominUserManager userManager)
{ {
_adRepository = adRepositry;
UserManager = userManager; UserManager = userManager;
} }
@ -24,17 +29,23 @@ namespace Sevomin.WebFrontend.Controllers
{ {
if (!Request.IsAuthenticated) if (!Request.IsAuthenticated)
return View("Intro"); return View("Intro");
else
{
User user = await UserManager.FindByNameAsync(User.Identity.Name);
if (user is Avalin)
return View("AvalinIndex");
else if (user is Dovomin)
return View("DovominIndex");
else
return RedirectToAction("Index", "God");
}
User user = await UserManager.FindByNameAsync(User.Identity.Name);
if (user is Avalin)
return View("AvalinIndex");
if (user is Dovomin)
return View("DovominIndex");
return RedirectToAction("Index", "God");
} }
public ActionResult Ads(int id)
{
var ad = _adRepository.ListAll().SingleOrDefault(m => m.Id == id);
if (ad == null)
{
return HttpNotFound();
}
ad.ClickCount++;
return Redirect(ad.Link);
}
} }
} }

+ 7
- 3
Sevomin.WebFrontend.Controllers/JobController.cs View File

@ -19,11 +19,12 @@ namespace Sevomin.WebFrontend.Controllers
{ {
public class JobController : AuthorizedController public class JobController : AuthorizedController
{ {
IAdRepository _adRepository;
IJobRepository _jobRepository; IJobRepository _jobRepository;
private HttpContextBase _httpContext; private HttpContextBase _httpContext;
public JobController() public JobController()
: this(JobRepository.Current,
: this(AdRepository.Current, JobRepository.Current,
new SevominUserManager(new UserStore<User>(SevominDbContext.Current)), null) new SevominUserManager(new UserStore<User>(SevominDbContext.Current)), null)
{ {
} }
@ -34,8 +35,9 @@ namespace Sevomin.WebFrontend.Controllers
_httpContext = requestContext.HttpContext; _httpContext = requestContext.HttpContext;
} }
public JobController(IJobRepository jobRepository, SevominUserManager userManager, HttpContextBase httpContext) : base(userManager)
public JobController(IAdRepository adRepository, IJobRepository jobRepository, SevominUserManager userManager, HttpContextBase httpContext) : base(userManager)
{ {
_adRepository = adRepository;
_jobRepository = jobRepository; _jobRepository = jobRepository;
_httpContext = httpContext; _httpContext = httpContext;
} }
@ -179,6 +181,7 @@ namespace Sevomin.WebFrontend.Controllers
[AllowAnonymous] [AllowAnonymous]
public ActionResult RecentJobs() public ActionResult RecentJobs()
{ {
ViewBag.Ads = _adRepository.GetAds();
return View(_jobRepository.ListAll() return View(_jobRepository.ListAll()
.Where(d => d.ExpireDate >= DateTime.UtcNow) .Where(d => d.ExpireDate >= DateTime.UtcNow)
.OrderByDescending(d => d.CreateDate).ThenByDescending(d => d.ExpireDate) .OrderByDescending(d => d.CreateDate).ThenByDescending(d => d.ExpireDate)
@ -188,7 +191,8 @@ namespace Sevomin.WebFrontend.Controllers
[AllowAnonymous] [AllowAnonymous]
public PartialViewResult LatestJobList(int count) public PartialViewResult LatestJobList(int count)
{
{
ViewBag.Ads = _adRepository.GetAds();
return PartialView("JobList", _jobRepository.ListAll() return PartialView("JobList", _jobRepository.ListAll()
.Where(d => d.ExpireDate >= DateTime.UtcNow) .Where(d => d.ExpireDate >= DateTime.UtcNow)
.OrderByDescending(d => d.CreateDate) .OrderByDescending(d => d.CreateDate)


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

@ -97,7 +97,6 @@
</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" />


+ 3
- 2
Sevomin.WebFrontend/App_Start/RouteConfig.cs View File

@ -142,11 +142,12 @@ namespace Sevomin.WebFrontend
#endregion #endregion
#region God Mode #region God Mode
routes.MapRoute( routes.MapRoute(
name: "TurnOnGodMode", name: "TurnOnGodMode",
url: "god-mode/{action}", url: "god-mode/{action}",
defaults: new { controller = "God", action = "Index" }
);
defaults: new {controller = "God", action = "Index"}
);
#endregion #endregion
routes.MapRoute( routes.MapRoute(


+ 44
- 26
Sevomin.WebFrontend/Views/God/AdManagementPanel.cshtml View File

@ -1,4 +1,5 @@
@model IQueryable<Sevomin.Models.Ad>
@using Sevomin.Models.Helpers
@model IQueryable<Sevomin.Models.Ad>
@if (Model.Any()) @if (Model.Any())
{ {
@ -6,7 +7,7 @@
<div class="col-md-12 rtl"> <div class="col-md-12 rtl">
<div class="panel panel-default" id="ad-management-panel"> <div class="panel panel-default" id="ad-management-panel">
<div class="panel-heading"> <div class="panel-heading">
<h4 class="panel-title"><a data-toggle="collapse" data-parent="ad-management-panel" href="#ad-management-panel-body">ویرایش متن راهنمای پارامترها</a></h4>
<h4 class="panel-title"><a data-toggle="collapse" data-parent="ad-management-panel" href="#ad-management-panel-body">مدیریت آگهی ها</a></h4>
</div> </div>
<div id="ad-management-panel-body" class="panel-collapse collapse in"> <div id="ad-management-panel-body" class="panel-collapse collapse in">
<div class="panel-body"> <div class="panel-body">
@ -16,26 +17,45 @@
</div> </div>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<ul>
<ul class="list-unstyled">
@foreach (var ad in Model.Where(m => m.Active)) @foreach (var ad in Model.Where(m => m.Active))
{ {
<li> <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>
@using (Html.BeginForm("ChangeDays", "God", FormMethod.Post))
{
<div class="row">
<div class="col-md-2">
@DateAssist.GetFullPersianDate(ad.CreatedDate)
</div>
<div class="col-md-7">
@ad.Description
</div>
<div class="col-md-3">
@ad.Title
</div>
</div>
<div class="row">
<div class="col-md-1">
<a href="@Url.Action("ToggleAd", new {id = ad.Id})" class="btn btn-default">غیر فعالسازی</a>
</div>
<div class="col-md-1">
<button class="btn btn-default" type="submit">تغییر روز</button>
</div>
<input type="hidden" name="id" value="@ad.Id" />
<div class="col-md-2">
<input type="number" placeholder="تغییر روز" name="days" value="@ad.Duration"/>
</div>
<div class="col-md-2">
تعداد کلیک ها: @ad.ClickCount
</div>
<div class="col-md-2">
روز: @ad.Duration
</div>
<div class="col-md-3">
<a href="@ad.Link">@ad.Link</a>
</div>
</div>
}
</li> </li>
} }
</ul> </ul>
@ -46,20 +66,18 @@
</div> </div>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<ul>
<ul class="list-unstyled">
@foreach (var ad in Model.Where(m => !m.Active)) @foreach (var ad in Model.Where(m => !m.Active))
{ {
<li> <li>
<div class="col-md-3">
@ad.Title
<div class="col-md-2">
<a href="@Url.Action("ToggleAd", new { id = ad.Id })" class="btn btn-default">فعالسازی</a>
</div> </div>
<div class="col-md-7"> <div class="col-md-7">
@ad.Description @ad.Description
</div> </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 class="col-md-3">
@ad.Title
</div> </div>
</li> </li>
} }


+ 106
- 94
Sevomin.WebFrontend/Views/God/Index.cshtml View File

@ -51,7 +51,7 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<p>برای تست: @(HttpContext.Current.Application["ApplicationStart"] == null ? "اجرا نشده" : (DateTime.Now - (DateTime) HttpContext.Current.Application["ApplicationStart"]).Minutes.ToString())</p>
<p>برای تست: @(HttpContext.Current.Application["ApplicationStart"] == null ? "اجرا نشده" : (DateTime.Now - (DateTime)HttpContext.Current.Application["ApplicationStart"]).Minutes.ToString())</p>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-stripped table-bordered"> <table class="table table-stripped table-bordered">
<thead> <thead>
@ -78,41 +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" id="ad-panel">
<div class="panel panel-default" id="add-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="add-ad-panel" href="#add-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 id="add-ad-panel-body" class="panel-collapse collapse in">
<div class="panel-body" id="advertisement-panel">
@using (Html.BeginForm("AddAd", "God", FormMethod.Post, new { @class = "form-horizontal" }))
{
<div class="form-group">
<div class="col-md-4 col-md-offset-1">
<input class="form-control" name="duration" type="number" id="duration-input" placeholder="مدت" />
</div>
<label for="duration-input" class="col-md-1 control-label">مدت</label>
<div class="col-md-4 col-md-offset-1">
<input class="form-control" name="title" type="text" id="title-input" placeholder="عنوان" />
</div>
<label for="title-input" class="col-md-1 control-label">عنوان</label>
</div> </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 class="form-group">
<div class="col-md-8 col-md-offset-3">
<textarea class="form-control" id="description-input" name="description" rows="2" placeholder="متن"></textarea>
</div>
<label for="description-input" class="col-md-1 control-label">متن</label>
</div> </div>
<div class="col-md-3">
<button class="btn btn-default" type="submit" role="button">درج آگهی</button>
<div class="form-group">
<div class="col-md-1 col-md-offset-1">
<button class="btn btn-default" type="button" role="button" id="preview">تست تبلیغ</button>
</div>
<div class="col-md-1 col-md-offset-1">
<button class="btn btn-default" type="submit" role="button">درج آگهی</button>
</div>
<div class="col-md-4 col-md-offset-3">
<input type="text" name="link" placeholder="لینک حتما باید با http شروع شود" class="form-control" id="link-input" />
</div>
<label class='col-md-1 control-label' for="link-input">لینک</label>
</div> </div>
</div>
}
</div> </div>
</div> </div>
</div> </div>
@ -131,25 +133,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>
@ -167,58 +169,58 @@
.Where(a => a.Jobs != null && a.Jobs.Any(j => j.ExpireDate.Date >= DateTime.Now.Date)) .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) .OrderByDescending(a => a.Jobs.OrderByDescending(j => j.CreateDate).First().CreateDate)
.ToList()) .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 (job.Applications.Count == 0)
if (avalin.Jobs.Count == 0)
{ {
continue; 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))
<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))
{ {
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))
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))
{ {
<h5>پیغام متخصص:</h5>
<blockquote>@apply.CoverLetter</blockquote>
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>
} }
@if (apply.MinimumRequirement)
{
<p>این متخصص تمامی مهارت های الزامی برای این فرصت شغلی را دارد. همچنین میزان مطابقت ایشان با این فرصت شغلی، @apply.Affinity درصد است.</p>
}
else
{
<p>این متخصص برخی مهارت های الزامی برای این فرصت شغلی را ندارد. همچنین میزان مطابقت ایشان با این فرصت شغلی، @apply.Affinity درصد است.</p>
}
</div>
</div>
} }
</div>
</div>
} }
</div>
}
</div> </div>
</div> </div>
</div> </div>
@ -248,12 +250,22 @@
commentDovomin = $(obj).text(); commentDovomin = $(obj).text();
}); });
$.post('@Url.Action("UpdateParam", "God")', { paramId: paramId, commentAvalin: commentAvalin, commentDovomin: commentDovomin }) $.post('@Url.Action("UpdateParam", "God")', { paramId: paramId, commentAvalin: commentAvalin, commentDovomin: commentDovomin })
.success(function () {
console.log('done');
});
.success(function () {
console.log('done');
});
});
$('#preview').on('click', function () {
$('#preview-box').remove();
var url = $('#link-input').val();
var title = $('#title-input').val();
var desc = $('#description-input').val();
$('#advertisement-panel').append('<div id="preview-box" class="panel col-md-3 pull-right panel-default"><div class="panel-body"><h4 class="rtl">' + title + '</h4><p class="rtl">' + desc + '</p><a href="' + url + '" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-link"></span> مشاهده سایت </a></div></div>');
}); });
}); });
</script> </script>
</body> </body>
</html> </html>

+ 28
- 2
Sevomin.WebFrontend/Views/Job/JobList.cshtml View File

@ -1,5 +1,31 @@
@model IList<Sevomin.Models.JobMiniViewModel>
<section>
@using Sevomin.Models
@model IList<Sevomin.Models.JobMiniViewModel>
@{
IEnumerable<Ad> ads = ViewBag.Ads;
var adsExist = (ads != null && ads.Any());
}
@if (adsExist)
{
<section class="col-md-3">
@foreach (var ad in ads)
{
<div class="panel panel-default">
<div class="panel-body">
<h4 class="rtl">
@ad.Title
</h4>
<p class="rtl">
@ad.Description
</p>
<a href="@Url.Action("Ads", "Home", new {id = ad.Id})" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-link"></span> مشاهده سایت </a>
</div>
</div>
}
</section>
}
<section class="@(adsExist ? "col-md-9" : "col-md-12")">
@if (User.IsInRole("Avalin") && Model.Count == 0) @if (User.IsInRole("Avalin") && Model.Count == 0)
{ {
<div class="panel panel-default"> <div class="panel panel-default">


Loading…
Cancel
Save