diff --git a/Models/eva_adjust_postponement_normal/eva_adjust_postponement_normalService.cs b/Models/eva_adjust_postponement_normal/eva_adjust_postponement_normalService.cs index 0fa31e5..b2fe1fd 100644 --- a/Models/eva_adjust_postponement_normal/eva_adjust_postponement_normalService.cs +++ b/Models/eva_adjust_postponement_normal/eva_adjust_postponement_normalService.cs @@ -20,14 +20,14 @@ namespace TodoAPI2.Models public class eva_adjust_postponement_normalService : Ieva_adjust_postponement_normalService { private IBaseRepository2 _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 repository, IMyDatabase mydb, + public eva_adjust_postponement_normalService(IBaseRepository2 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>(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 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 GetListBySearch(eva_adjust_postponement_normalSearchModel model) + public List 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 model) + public string UpdateMultiple(List 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(); } diff --git a/Models/eva_create_evaluation_detail_status/eva_create_evaluation_detail_statusService.cs b/Models/eva_create_evaluation_detail_status/eva_create_evaluation_detail_statusService.cs index 26a8a70..18bdea9 100644 --- a/Models/eva_create_evaluation_detail_status/eva_create_evaluation_detail_statusService.cs +++ b/Models/eva_create_evaluation_detail_status/eva_create_evaluation_detail_statusService.cs @@ -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); diff --git a/ViewControllers/eva_create_evaluation_detail_firstdocViewControllers.cs b/ViewControllers/eva_create_evaluation_detail_firstdocViewControllers.cs index d273110..705ecc8 100644 --- a/ViewControllers/eva_create_evaluation_detail_firstdocViewControllers.cs +++ b/ViewControllers/eva_create_evaluation_detail_firstdocViewControllers.cs @@ -16,30 +16,36 @@ namespace TodoAPI2.Controllers { private ILogger _logger; private Ieva_create_evaluation_detail_firstdocService _repository; - private IConfiguration Configuration { get; set; } - + private Iexternal_employeeService emp; + private IConfiguration Configuration { get; set; } + /// /// Default constructure for dependency injection /// /// - /// + /// + /// /// - public eva_create_evaluation_detail_firstdocViewController(ILogger logger, Ieva_create_evaluation_detail_firstdocService repository, IConfiguration configuration) + public eva_create_evaluation_detail_firstdocViewController(ILogger 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(); } diff --git a/Views/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d.cshtml b/Views/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d.cshtml index d4675b1..3b0cfa9 100644 --- a/Views/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d.cshtml +++ b/Views/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d.cshtml @@ -263,7 +263,7 @@
- +
diff --git a/Views/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc_d.cshtml b/Views/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc_d.cshtml index 3310221..f33b62e 100644 --- a/Views/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc_d.cshtml +++ b/Views/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc_d.cshtml @@ -154,7 +154,7 @@
- +
diff --git a/Views/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d.cshtml b/Views/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d.cshtml index 1423dac..c9ab50f 100644 --- a/Views/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d.cshtml +++ b/Views/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d.cshtml @@ -69,7 +69,7 @@
- +
diff --git a/Views/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d2.cshtml b/Views/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d2.cshtml index 686270a..6f2d1d9 100644 --- a/Views/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d2.cshtml +++ b/Views/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d2.cshtml @@ -118,7 +118,7 @@
- +
diff --git a/Views/eva_create_evaluation_detail_review0AView/eva_create_evaluation_detail_review0A_d.cshtml b/Views/eva_create_evaluation_detail_review0AView/eva_create_evaluation_detail_review0A_d.cshtml deleted file mode 100644 index c683e39..0000000 --- a/Views/eva_create_evaluation_detail_review0AView/eva_create_evaluation_detail_review0A_d.cshtml +++ /dev/null @@ -1,88 +0,0 @@ -@using Microsoft.Extensions.Configuration -@inject IConfiguration Configuration -@{ - ViewData["Title"] = "eva_create_evaluation_detail_review0A"; - Layout = "_LayoutDirect"; -} - -
-
-
- @Configuration["SiteInformation:modulename"] -
-
-
- -
-
- -
-
บันทึกข้อมูล eva_create_evaluation_detail_review0A
- -
-
- กรุณากรอกข้อมูลลงในแบบฟอร์ม -
-
- -
-
- - - - - -
-
-
-
- - -
- -
- - -
-
-
-
- - -
-
- - -
-
-
-
- -
-
- - -
-
- -
- -@section FooterPlaceHolder{ - - -} - diff --git a/tb320eva.csproj b/tb320eva.csproj index 451424a..cc8ab0f 100644 --- a/tb320eva.csproj +++ b/tb320eva.csproj @@ -70,7 +70,6 @@ - diff --git a/tb320eva.xml b/tb320eva.xml index 42def7a..61a279f 100644 --- a/tb320eva.xml +++ b/tb320eva.xml @@ -4461,12 +4461,13 @@ - + Default constructure for dependency injection +