ปรับปรุงเพิ่มเติม ตามที่้น้องเพลงแจ้ง

This commit is contained in:
Nakorn Rientrakrunchai
2021-02-15 18:52:16 +07:00
parent bba1429925
commit 2825bdde24
10 changed files with 62 additions and 140 deletions

View File

@@ -20,14 +20,14 @@ namespace TodoAPI2.Models
public class eva_adjust_postponement_normalService : Ieva_adjust_postponement_normalService
{
private IBaseRepository2<eva_adjust_postponementEntity, int> _repository;
private IMyDatabase db;
private Iexternal_linkageService ext;
private IMyDatabase db;
private Iexternal_linkageService ext;
private Iexternal_employeeService emp;
private Ieva_create_evaluationService create;
private Ieva_adjust_postponement_detail_normalService detail;
private Ieva_adjust_postponement_detail_normal_02Service normal02;
public eva_adjust_postponement_normalService(IBaseRepository2<eva_adjust_postponementEntity, int> repository, IMyDatabase mydb,
public eva_adjust_postponement_normalService(IBaseRepository2<eva_adjust_postponementEntity, int> repository, IMyDatabase mydb,
Iexternal_linkageService inext,
Iexternal_employeeService inemp,
Ieva_create_evaluationService increate,
@@ -35,8 +35,8 @@ namespace TodoAPI2.Models
Ieva_adjust_postponement_detail_normal_02Service innormal02)
{
_repository = repository;
db = mydb;
ext = inext;
db = mydb;
ext = inext;
emp = inemp;
create = increate;
detail = indetail;
@@ -60,7 +60,7 @@ namespace TodoAPI2.Models
{
return Mapper.Map<List<eva_adjust_postponement_normalViewModel>>(entities);
}
#endregion
#region Public Functions
@@ -84,7 +84,7 @@ namespace TodoAPI2.Models
var temp = create.GetListBySearch(new eva_create_evaluationSearchModel());
i.item_create_evaluation_id = (from x in temp where avaliable_eva.Contains(x.id) select x).ToList();
var all_emp = emp.GetListByemployee_type(null, null);
i.item_managed_by = all_emp.ToList();
i.item_managed_by = all_emp.ToList();
i.item_org_id = (from x in ext.GetDepartmentData() select x).ToList();
@@ -109,19 +109,19 @@ namespace TodoAPI2.Models
public List<eva_adjust_postponement_normalViewModel> GetListByfiscal_year(int? fiscal_year)
{
var model = new eva_adjust_postponement_normalSearchModel();
var model = new eva_adjust_postponement_normalSearchModel();
model.fiscal_year = fiscal_year;
return GetListBySearch(model);
}
public List<eva_adjust_postponement_normalViewModel> GetListBySearch(eva_adjust_postponement_normalSearchModel model)
public List<eva_adjust_postponement_normalViewModel> GetListBySearch(eva_adjust_postponement_normalSearchModel model)
{
var all_emp = emp.GetListByemployee_type(null, null);
var dep = ext.GetDepartmentData();
var avaliable_eva = (from j in _repository.Context.eva_create_evaluation
where j.employee_id == model.emp_id
select j.id).ToList();
where j.employee_id == model.emp_id
select j.id).ToList();
var data = (
from m_eva_adjust_postponement_normal in _repository.Context.eva_adjust_postponement
@@ -134,9 +134,9 @@ namespace TodoAPI2.Models
into external_linkageResult9
from fk_external_linkageResult9 in external_linkageResult9.DefaultIfEmpty()
//join fk_external_linkage10 in dep on fk_eva_create_evaluationResult4. equals fk_external_linkage10.id
//into external_linkageResult10
//from fk_external_linkageResult10 in external_linkageResult10.DefaultIfEmpty()
//join fk_external_linkage10 in dep on fk_eva_create_evaluationResult4. equals fk_external_linkage10.id
//into external_linkageResult10
//from fk_external_linkageResult10 in external_linkageResult10.DefaultIfEmpty()
join fk_eva_performance_plan1 in _repository.Context.eva_performance_plan on fk_eva_create_evaluationResult4.performance_plan_id equals fk_eva_performance_plan1.id
into eva_performance_planResult1
@@ -146,7 +146,7 @@ namespace TodoAPI2.Models
into eva_evaluation_groupResult5
from fk_eva_evaluation_groupResult5 in eva_evaluation_groupResult5.DefaultIfEmpty()
where 1==1
where 1 == 1
&& avaliable_eva.Contains(m_eva_adjust_postponement_normal.create_evaluation_id.Value)
//&& (m_eva_adjust_postponement_normal.id == model.id || !model.id.HasValue)
&& (m_eva_adjust_postponement_normal.fiscal_year == model.fiscal_year || !model.fiscal_year.HasValue)
@@ -192,10 +192,10 @@ namespace TodoAPI2.Models
int? newkey = 0;
var x = (from i in _repository.Context.eva_adjust_postponement
orderby i.id descending
select i).Take(1).ToList();
orderby i.id descending
select i).Take(1).ToList();
if(x.Count > 0)
if (x.Count > 0)
{
newkey = x[0].id + 1;
}
@@ -210,7 +210,7 @@ namespace TodoAPI2.Models
detail.ReCreatePostponementDetailNormal(entity);
var inserted = _repository.Insert(entity);
var inserted = _repository.Insert(entity);
return Get(inserted.id);
}
@@ -237,28 +237,28 @@ namespace TodoAPI2.Models
return Get(updated.id);
}
else
throw new NotificationException("No data to update");
throw new NotificationException("No data to update");
}
public string UpdateMultiple(List<eva_adjust_postponement_normalInputModel> model)
public string UpdateMultiple(List<eva_adjust_postponement_normalInputModel> model)
{
foreach(var i in model)
foreach (var i in model)
{
if (i.active_mode == "1" && i.id.HasValue) // update
{
{
var existingEntity = _repository.Get(i.id.Value);
if (existingEntity != null)
{
existingEntity.fiscal_year = i.fiscal_year;
existingEntity.theDate = i.theDate;
existingEntity.theRound = i.theRound;
existingEntity.create_evaluation_id = i.create_evaluation_id;
existingEntity.limit = i.limit;
existingEntity.limit_frame = i.limit_frame;
existingEntity.limit_quota = i.limit_quota;
existingEntity.percentage = i.percentage;
existingEntity.managed_by = i.managed_by;
//existingEntity.org_id = i.org_id;
existingEntity.fiscal_year = i.fiscal_year;
existingEntity.theDate = i.theDate;
existingEntity.theRound = i.theRound;
existingEntity.create_evaluation_id = i.create_evaluation_id;
existingEntity.limit = i.limit;
existingEntity.limit_frame = i.limit_frame;
existingEntity.limit_quota = i.limit_quota;
existingEntity.percentage = i.percentage;
existingEntity.managed_by = i.managed_by;
//existingEntity.org_id = i.org_id;
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
@@ -271,15 +271,15 @@ namespace TodoAPI2.Models
_repository.InsertWithoutCommit(entity);
}
else if (i.active_mode == "0" && i.id.HasValue) // remove
{
{
_repository.DeleteWithoutCommit(i.id.Value);
}
else if (i.active_mode == "0" && !i.id.HasValue)
{
// nothing to do
}
}
}
_repository.Context.SaveChanges();
_repository.Context.SaveChanges();
return model.Count().ToString();
}

View File

@@ -190,7 +190,7 @@ namespace TodoAPI2.Models
int? owner_eva_employee_id = existingEntity.employee_id;
string noti_message = "กรุณาตรวจสอบแบบประเมินของ {0}";
string noti_url = "/eva/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d2?id=" + existingEntity.id.ToString();
bool need_noti = true;
if (model.status_mode == "nextA")
{
@@ -198,7 +198,7 @@ namespace TodoAPI2.Models
existingEntity.status_chief_a_click_date = null;
noti_to_employee_id = existingEntity.chief;
noti_message = "กรุณาตรวจสอบ ข้อตกลงการประเมิน ของ {0}";
noti_url = "/eva/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_firstdoc_d?id=" + existingEntity.id.ToString();
noti_url = "/eva/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc_d?id=" + existingEntity.id.ToString();
}
else if (model.status_mode == "backB")
{
@@ -206,7 +206,7 @@ namespace TodoAPI2.Models
existingEntity.status_self_a_click_date = null;
noti_to_employee_id = existingEntity.employee_id;
noti_message = "ข้อตกลงการประเมินของคุณ ({0}) ถูกตีกลับ";
noti_url = "/eva/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_firstdoc_d?id=" + existingEntity.id.ToString();
noti_url = "/eva/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc_d?id=" + existingEntity.id.ToString();
}
else if (model.status_mode == "nextB")
{
@@ -219,6 +219,7 @@ namespace TodoAPI2.Models
{
noti_to_employee_id = current_eva.employee_id;
}
need_noti = false;
}
else if (model.status_mode == "next0")
{
@@ -286,7 +287,10 @@ namespace TodoAPI2.Models
noti_url = "/eva/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d2?id=" + existingEntity.id.ToString();
}
SendNotification(noti_to_employee_id, owner_eva_employee_id, existingEntity.id, noti_message, noti_url);
if (need_noti)
{
SendNotification(noti_to_employee_id, owner_eva_employee_id, existingEntity.id, noti_message, noti_url);
}
var updated = _repository.Update(id, existingEntity);
return Get(updated.id);

View File

@@ -16,30 +16,36 @@ namespace TodoAPI2.Controllers
{
private ILogger<eva_create_evaluation_detail_firstdocController> _logger;
private Ieva_create_evaluation_detail_firstdocService _repository;
private IConfiguration Configuration { get; set; }
private Iexternal_employeeService emp;
private IConfiguration Configuration { get; set; }
/// <summary>
/// Default constructure for dependency injection
/// </summary>
/// <param name="repository"></param>
/// <param name="configuration"></param>
/// <param name="configuration"></param>
/// <param name="inemp"></param>
/// <param name="logger"></param>
public eva_create_evaluation_detail_firstdocViewController(ILogger<eva_create_evaluation_detail_firstdocController> logger, Ieva_create_evaluation_detail_firstdocService repository, IConfiguration configuration)
public eva_create_evaluation_detail_firstdocViewController(ILogger<eva_create_evaluation_detail_firstdocController> logger,
Ieva_create_evaluation_detail_firstdocService repository, IConfiguration configuration, Iexternal_employeeService inemp)
{
_logger = logger;
_repository = repository;
Configuration = configuration;
emp = inemp;
}
public IActionResult eva_create_evaluation_detail_firstdoc()
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView
MyHelper.get_login(HttpContext, emp, Response);
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView
return View();
}
public IActionResult eva_create_evaluation_detail_firstdoc_d()
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView
MyHelper.get_login(HttpContext, emp, Response);
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView
return View();
}

View File

@@ -263,7 +263,7 @@
<div class="row">
<div class="form-group col-md-12">
<button type="button" class="btn btn-danger" onclick="javascript:window_close()"><i class="fa fa-repeat"></i> กลับ</button>
<button type="button" class="btn btn-danger" onclick="javascript:window_open_from_root('@MyHelper.GetConfig(Configuration, "SiteInformation:mainsite")');"><i class="fa fa-repeat"></i> กลับ</button>
</div>
</div>

View File

@@ -154,7 +154,7 @@
<div class="row">
<div class="form-group col-md-12">
<button type="button" class="btn btn-danger" onclick="javascript:window_close()"><i class="fa fa-repeat"></i> กลับ</button>
<button type="button" class="btn btn-danger" onclick="javascript:window_open_from_root('@MyHelper.GetConfig(Configuration, "SiteInformation:mainsite")');"><i class="fa fa-repeat"></i> กลับ</button>
</div>
</div>

View File

@@ -69,7 +69,7 @@
<div class="row">
<div class="form-group col-md-12">
<button type="button" class="btn btn-danger" onclick="javascript:window_close()"><i class="fa fa-repeat"></i> กลับ</button>
<button type="button" class="btn btn-danger" onclick="javascript:window_open_from_root('@MyHelper.GetConfig(Configuration, "SiteInformation:mainsite")');"><i class="fa fa-repeat"></i> กลับ</button>
</div>
</div>

View File

@@ -118,7 +118,7 @@
<div class="row">
<div class="form-group col-md-12">
<button type="button" class="btn btn-danger" onclick="javascript:window_close()"><i class="fa fa-repeat"></i> กลับ</button>
<button type="button" class="btn btn-danger" onclick="javascript:window_open_from_root('@MyHelper.GetConfig(Configuration, "SiteInformation:mainsite")');"><i class="fa fa-repeat"></i> กลับ</button>
</div>
</div>

View File

@@ -1,88 +0,0 @@
@using Microsoft.Extensions.Configuration
@inject IConfiguration Configuration
@{
ViewData["Title"] = "eva_create_evaluation_detail_review0A";
Layout = "_LayoutDirect";
}
<div class="row page-title">
<div class="col-md-5">
<div class="page-title">
@Configuration["SiteInformation:modulename"]
</div>
</div>
<div class="col-md-7">
<ol class="breadcrumb" style="">
<li class="breadcrumb-item "><a href="@Configuration["SiteInformation:mainsite"]">หน้าแรก</a></li>
<li class="breadcrumb-item "><a href="@Configuration["SiteInformation:mainsite"]@Configuration["SiteInformation:appsite"]">@Configuration["SiteInformation:modulename"]</a></li>
<li class="breadcrumb-item active">eva_create_evaluation_detail_review0A</li>
</ol>
</div>
</div>
<section class="wrapper">
<div class="title col-md-12"><div class="line"></div>บันทึกข้อมูล eva_create_evaluation_detail_review0A</div>
<section class="card no-border">
<header class="card-header">
กรุณากรอกข้อมูลลงในแบบฟอร์ม
</header>
<div class="card-body" style="">
<div class="row">
<div class="col-md-12">
<input class="form-control" type="hidden" id="eva_create_evaluation_detail_review0A_id" />
<input class="form-control" type="hidden" id="eva_create_evaluation_detail_review0A_create_evaluation_id" />
<input class="form-control" type="hidden" id="eva_create_evaluation_detail_review0A_chief_a" />
<div class='row'></div>
<div class='row'></div>
<div class='row'>
<div class="form-group col-md-6">
<label id="lab_eva_create_evaluation_detail_review0A_chief_a_result" for="eva_create_evaluation_detail_review0A_chief_a_result">ผลการประเมิน</label>
<select class="form-control" id="eva_create_evaluation_detail_review0A_chief_a_result" iLabel="ผลการประเมิน" iRequire="true" iGroup="eva_create_evaluation_detail_review0A"></select>
</div>
<div class="form-group col-md-6">
<label id="lab_eva_create_evaluation_detail_review0A_chief_a_date" for="eva_create_evaluation_detail_review0A_chief_a_date">วันที่ประเมิน</label>
<input class="form-control" type="text" id="eva_create_evaluation_detail_review0A_chief_a_date" data-provide="datepicker" data-date-language="th-th" iLabel="วันที่ประเมิน" iRequire="true" iGroup="eva_create_evaluation_detail_review0A" />
</div>
</div>
<div class='row'>
<div class="form-group col-md-12">
<label id="lab_eva_create_evaluation_detail_review0A_chief_a_remark" for="eva_create_evaluation_detail_review0A_chief_a_remark">ความเห็นผู้ประเมินสูงสุด</label>
<textarea class="form-control" rows="4" cols="50" id="eva_create_evaluation_detail_review0A_chief_a_remark" iLabel="ความเห็นผู้ประเมินสูงสุด" iRequire="true" iGroup="eva_create_evaluation_detail_review0A"></textarea>
</div>
</div>
</div>
</div>
</div>
</section>
<div class="row">
<div class="form-group col-md-12">
<button type="button" class="btn btn-outline" onclick="javascript:window_close()" style="background-color: #fff;">ยกเลิก</button>
<button type="button" class="btn btn-submit" onclick="javascript:eva_create_evaluation_detail_review0A_PutUpdate()">บันทึก</button>
</div>
</div>
</section>
@section FooterPlaceHolder{
<script src="~/js/eva_create_evaluation_detail_review0A/eva_create_evaluation_detail_review0A_d.js"></script>
<script>
$(document).ready(function () {
var id = getUrlParameter("id");
if (id) {
eva_create_evaluation_detail_review0A_SetEditForm(id);
} else {
eva_create_evaluation_detail_review0A_SetCreateForm();
}
SetupValidationRemark("eva_create_evaluation_detail_review0A");
});
</script>
}

View File

@@ -70,7 +70,6 @@
<Folder Include="Seed\" CopyToOutputDirectory="Always" />
<None Include="Views\eva_create_evaluation_detail_firstdocView\eva_create_evaluation_detail_firstdoc.cshtml" />
<None Include="Views\eva_create_evaluation_detail_firstdocView\eva_create_evaluation_detail_firstdoc_d.cshtml" />
<None Include="Views\eva_create_evaluation_detail_review0AView\eva_create_evaluation_detail_review0A_d.cshtml" />
<None Include="Views\eva_evaluation_operating_agreementView\eva_evaluation_operating_agreement.cshtml" />
<None Include="wwwroot\js\eva_adjust_postponement_detail_migration\eva_adjust_postponement_detail_migration.js" />
<None Include="wwwroot\js\eva_adjust_postponement_migration\eva_adjust_postponement_migration.js" />

View File

@@ -4461,12 +4461,13 @@
<param name="logger"></param>
<param name="inemp"></param>
</member>
<member name="M:TodoAPI2.Controllers.eva_create_evaluation_detail_firstdocViewController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.eva_create_evaluation_detail_firstdocController},TodoAPI2.Models.Ieva_create_evaluation_detail_firstdocService,Microsoft.Extensions.Configuration.IConfiguration)">
<member name="M:TodoAPI2.Controllers.eva_create_evaluation_detail_firstdocViewController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.eva_create_evaluation_detail_firstdocController},TodoAPI2.Models.Ieva_create_evaluation_detail_firstdocService,Microsoft.Extensions.Configuration.IConfiguration,TodoAPI2.Models.Iexternal_employeeService)">
<summary>
Default constructure for dependency injection
</summary>
<param name="repository"></param>
<param name="configuration"></param>
<param name="inemp"></param>
<param name="logger"></param>
</member>
<member name="M:TodoAPI2.Controllers.eva_create_evaluation_detail_processViewController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.eva_create_evaluation_detail_processController},TodoAPI2.Models.Iexternal_employeeService,TodoAPI2.Models.Ieva_create_evaluation_detail_processService,Microsoft.Extensions.Configuration.IConfiguration)">