diff --git a/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocService.cs b/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocService.cs index 50c10e8..a758824 100644 --- a/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocService.cs +++ b/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocService.cs @@ -229,6 +229,11 @@ namespace TodoAPI2.Models var alldep = (from x in emp.GetDeptMapping() where x.id == dep || x.id2 == dep select x.id); + var option_1 = new external_linkageViewModel(); + option_1.id_guid = Guid.Empty; + option_1.external_name = "ทั้งหมด"; + var option_all = new List(); + option_all.Add(option_1); var alleva = (from x in _repository.Context.eva_create_evaluation join y in _repository.Context.eva_create_evaluation_detail on x.id equals y.create_evaluation_id where x.employee_id == emp_id @@ -247,10 +252,10 @@ namespace TodoAPI2.Models orderby x.fullname select new external_linkageViewModel { external_id = x.id, external_name = x.fullname } ).ToList(); - i.item_evaluation_round_search = (from x in _repository.Context.eva_performance_plan + i.item_evaluation_round_search = option_all.Union((from x in _repository.Context.eva_performance_plan orderby x.fiscal_year descending, x.theTime descending select new external_linkageViewModel { id_guid = x.id, external_name = checkNull(x.theTime) + "/" + checkNull(x.fiscal_year) } - ).ToList(); + )).ToList(); return i; } @@ -264,6 +269,11 @@ namespace TodoAPI2.Models var alldep = (from x in emp.GetDeptMapping() where x.id == dep || x.id2 == dep select x.id); + var option_1 = new external_linkageViewModel(); + option_1.id_guid = Guid.Empty; + option_1.external_name = "ทั้งหมด"; + var option_all = new List(); + option_all.Add(option_1); var alleva = (from x in _repository.Context.eva_create_evaluation join y in _repository.Context.eva_create_evaluation_detail on x.id equals y.create_evaluation_id where x.employee_id == emp_id @@ -282,10 +292,10 @@ namespace TodoAPI2.Models orderby x.fullname select new external_linkageViewModel { external_id = x.id, external_name = x.fullname } ).ToList(); - i.item_evaluation_round_search = (from x in _repository.Context.eva_performance_plan + i.item_evaluation_round_search = option_all.Union((from x in _repository.Context.eva_performance_plan orderby x.fiscal_year descending, x.theTime descending select new external_linkageViewModel { id_guid = x.id, external_name = checkNull(x.theTime) + "/" + checkNull(x.fiscal_year) } - ).ToList(); + )).ToList(); return i; } @@ -321,6 +331,10 @@ namespace TodoAPI2.Models select new external_linkageViewModel { id_guid = x.id, external_name = checkNull(x.theTime) + "/" + checkNull(x.fiscal_year) } ).FirstOrDefault().id_guid.ToString(); } + else if (Guid.Parse(model.evaluation_round_search) == Guid.Empty) + { + model.evaluation_round_search = null; + } var allemp = emp.GetListByemployee_type(null, null); var dept = ext.GetDepartmentData(); diff --git a/Models/eva_create_evaluation_detail_process/eva_create_evaluation_detail_processService.cs b/Models/eva_create_evaluation_detail_process/eva_create_evaluation_detail_processService.cs index e6cd364..69b3b47 100644 --- a/Models/eva_create_evaluation_detail_process/eva_create_evaluation_detail_processService.cs +++ b/Models/eva_create_evaluation_detail_process/eva_create_evaluation_detail_processService.cs @@ -225,6 +225,11 @@ namespace TodoAPI2.Models var alldep = (from x in emp.GetDeptMapping() where x.id == dep || x.id2 == dep select x.id); + var option_1 = new external_linkageViewModel(); + option_1.id_guid = Guid.Empty; + option_1.external_name = "ทั้งหมด"; + var option_all = new List(); + option_all.Add(option_1); var alleva = (from x in _repository.Context.eva_create_evaluation join y in _repository.Context.eva_create_evaluation_detail on x.id equals y.create_evaluation_id where x.employee_id == emp_id @@ -245,10 +250,16 @@ namespace TodoAPI2.Models && alleva.Contains(x.id) orderby x.fullname select x).ToList(); - item.item_evaluation_round_search = (from x in _repository.Context.eva_performance_plan - orderby x.fiscal_year descending, x.theTime descending - select new external_linkageViewModel { id_guid = x.id, external_name = checkNull(x.theTime) + "/" + checkNull(x.fiscal_year) } - ).ToList(); + + var allround = (from y in _repository.Context.eva_create_evaluation + select y.performance_plan_id).ToList(); + + item.item_evaluation_round_search = option_all.Union((from x in _repository.Context.eva_performance_plan + where allround.Contains(x.id) + orderby x.fiscal_year descending, x.theTime descending + select new external_linkageViewModel { id_guid = x.id, external_name = checkNull(x.theTime) + "/" + checkNull(x.fiscal_year) } + )).ToList(); + return item; } @@ -261,6 +272,12 @@ namespace TodoAPI2.Models var alldep = (from x in emp.GetDeptMapping() where x.id == dep || x.id2 == dep select x.id); + var option_1 = new external_linkageViewModel(); + option_1.id_guid = Guid.Empty; + option_1.external_name = "ทั้งหมด"; + var option_all = new List(); + option_all.Add(option_1); + var alleva = (from x in _repository.Context.eva_create_evaluation join y in _repository.Context.eva_create_evaluation_detail on x.id equals y.create_evaluation_id where x.employee_id == emp_id @@ -278,10 +295,15 @@ namespace TodoAPI2.Models && alleva.Contains(x.id) orderby x.fullname select x).ToList(); - i.item_evaluation_round_search = (from x in _repository.Context.eva_performance_plan + + var allround = (from y in _repository.Context.eva_create_evaluation + select y.performance_plan_id).ToList(); + + i.item_evaluation_round_search = option_all.Union((from x in _repository.Context.eva_performance_plan + where allround.Contains(x.id) orderby x.fiscal_year descending, x.theTime descending select new external_linkageViewModel { id_guid = x.id, external_name = checkNull(x.theTime) + "/" + checkNull(x.fiscal_year) } - ).ToList(); + )).ToList(); return i; } @@ -328,6 +350,10 @@ namespace TodoAPI2.Models select new external_linkageViewModel { id_guid = x.id, external_name = checkNull(x.theTime) + "/" + checkNull(x.fiscal_year) } ).FirstOrDefault().id_guid.ToString(); } + else if(Guid.Parse(model.evaluation_round_search) == Guid.Empty) + { + model.evaluation_round_search = null; + } var allemp = emp.GetListByemployee_type(null, null); var all_org_id = from i in ext.GetAllChildInDep(model.org_id) select i.external_id;