ปรับปรุงรายงานแบบประเมิน และแก้ไข bug จากผล unit test

This commit is contained in:
Nakorn Rientrakrunchai
2020-08-30 11:16:09 +07:00
parent a049fa6d8b
commit 2df3962e59
10 changed files with 160 additions and 96 deletions

View File

@@ -257,14 +257,14 @@ namespace TodoAPI2.Controllers
select x).FirstOrDefault(); select x).FirstOrDefault();
if(detail != null) if(detail != null)
{ {
i.total_summary_supervisor2A = detail.total_summary_supervisor2A; i.total_summary_supervisor2a = detail.total_summary_supervisor2A;
i.Final_summary_supervisor2A = detail.Final_summary_supervisor2A; i.final_summary_supervisor2a = detail.Final_summary_supervisor2A;
i.total_summary_competency_supervisor2A = detail.total_summary_competency_supervisor2A; i.total_summary_competency_supervisor2a = detail.total_summary_competency_supervisor2A;
i.Final_summary_competency_supervisor2A = detail.Final_summary_competency_supervisor2A; i.final_summary_competency_supervisor2a = detail.Final_summary_competency_supervisor2A;
i.achievement_supervisor2A = detail.achievement_supervisor2A; i.achievement_supervisor2a = detail.achievement_supervisor2A;
i.competency_supervisor2A = detail.competency_supervisor2A; i.competency_supervisor2a = detail.competency_supervisor2A;
i.score_supervisor2A = detail.score_supervisor2A; i.score_supervisor2a = detail.score_supervisor2A;
i.level_score_supervisor2A = detail.level_score_supervisor2A; i.level_score_supervisor2a = detail.level_score_supervisor2A;
} }
i.w1 = p.create_evaluation_score1; i.w1 = p.create_evaluation_score1;

View File

@@ -174,15 +174,66 @@ namespace TodoAPI2.Models
{ {
existingEntity.create_evaluation_id = model.create_evaluation_id; existingEntity.create_evaluation_id = model.create_evaluation_id;
existingEntity.total_summary_supervisor = model.total_summary_supervisor; //existingEntity.total_summary_supervisor = model.total_summary_supervisor;
existingEntity.Final_summary_supervisor = model.Final_summary_supervisor; //existingEntity.Final_summary_supervisor = model.Final_summary_supervisor;
existingEntity.total_summary_competency_supervisor = model.total_summary_competency_supervisor; //existingEntity.total_summary_competency_supervisor = model.total_summary_competency_supervisor;
existingEntity.Final_summary_competency_supervisor = model.Final_summary_competency_supervisor; //existingEntity.Final_summary_competency_supervisor = model.Final_summary_competency_supervisor;
existingEntity.achievement_supervisor = model.achievement_supervisor; //existingEntity.achievement_supervisor = model.achievement_supervisor;
existingEntity.competency_supervisor = model.competency_supervisor; //existingEntity.competency_supervisor = model.competency_supervisor;
existingEntity.score_supervisor = model.score_supervisor; //existingEntity.score_supervisor = model.score_supervisor;
existingEntity.level_score_supervisor = model.level_score_supervisor; //existingEntity.level_score_supervisor = model.level_score_supervisor;
if (model.who_update == "2")
{
existingEntity.total_summary_supervisor = model.total_summary_supervisor;
existingEntity.Final_summary_supervisor = model.Final_summary_supervisor;
existingEntity.total_summary_competency_supervisor = model.total_summary_competency_supervisor;
existingEntity.Final_summary_competency_supervisor = model.Final_summary_competency_supervisor;
existingEntity.achievement_supervisor = model.achievement_supervisor;
existingEntity.competency_supervisor = model.competency_supervisor;
existingEntity.score_supervisor = model.score_supervisor;
existingEntity.level_score_supervisor = model.level_score_supervisor;
existingEntity.total_summary_supervisor1A = model.total_summary_supervisor;
existingEntity.Final_summary_supervisor1A = model.Final_summary_supervisor;
existingEntity.total_summary_competency_supervisor1A = model.total_summary_competency_supervisor;
existingEntity.Final_summary_competency_supervisor1A = model.Final_summary_competency_supervisor;
existingEntity.achievement_supervisor1A = model.achievement_supervisor;
existingEntity.competency_supervisor1A = model.competency_supervisor;
existingEntity.score_supervisor1A = model.score_supervisor;
existingEntity.level_score_supervisor1A = model.level_score_supervisor;
}
else if (model.who_update == "3")
{
existingEntity.total_summary_supervisor1A = model.total_summary_supervisor;
existingEntity.Final_summary_supervisor1A = model.Final_summary_supervisor;
existingEntity.total_summary_competency_supervisor1A = model.total_summary_competency_supervisor;
existingEntity.Final_summary_competency_supervisor1A = model.Final_summary_competency_supervisor;
existingEntity.achievement_supervisor1A = model.achievement_supervisor;
existingEntity.competency_supervisor1A = model.competency_supervisor;
existingEntity.score_supervisor1A = model.score_supervisor;
existingEntity.level_score_supervisor1A = model.level_score_supervisor;
existingEntity.total_summary_supervisor2A = model.total_summary_supervisor;
existingEntity.Final_summary_supervisor2A = model.Final_summary_supervisor;
existingEntity.total_summary_competency_supervisor2A = model.total_summary_competency_supervisor;
existingEntity.Final_summary_competency_supervisor2A = model.Final_summary_competency_supervisor;
existingEntity.achievement_supervisor2A = model.achievement_supervisor;
existingEntity.competency_supervisor2A = model.competency_supervisor;
existingEntity.score_supervisor2A = model.score_supervisor;
existingEntity.level_score_supervisor2A = model.level_score_supervisor;
}
else if (model.who_update == "4")
{
existingEntity.total_summary_supervisor2A = model.total_summary_supervisor;
existingEntity.Final_summary_supervisor2A = model.Final_summary_supervisor;
existingEntity.total_summary_competency_supervisor2A = model.total_summary_competency_supervisor;
existingEntity.Final_summary_competency_supervisor2A = model.Final_summary_competency_supervisor;
existingEntity.achievement_supervisor2A = model.achievement_supervisor;
existingEntity.competency_supervisor2A = model.competency_supervisor;
existingEntity.score_supervisor2A = model.score_supervisor;
existingEntity.level_score_supervisor2A = model.level_score_supervisor;
}
var updated = _repository.Update(id, existingEntity); var updated = _repository.Update(id, existingEntity);
return Get(updated.id); return Get(updated.id);

View File

@@ -40,6 +40,7 @@ namespace TodoAPI2.Models
{ {
temp += " ถึง " + MyHelper.GetDateStringForReport(end_date); temp += " ถึง " + MyHelper.GetDateStringForReport(end_date);
} }
period_text = temp;
} }
public void DoAfterInsertUpdate(DataContext context) public void DoAfterInsertUpdate(DataContext context)

View File

@@ -20,14 +20,14 @@ namespace TodoAPI2.Models
public class eva_idp_planService : Ieva_idp_planService public class eva_idp_planService : Ieva_idp_planService
{ {
private IBaseRepository2<eva_idp_planEntity, int> _repository; private IBaseRepository2<eva_idp_planEntity, int> _repository;
private IMyDatabase db; private IMyDatabase db;
private Iexternal_linkageService ext; private Iexternal_linkageService ext;
public eva_idp_planService(IBaseRepository2<eva_idp_planEntity, int> repository, IMyDatabase mydb, Iexternal_linkageService inext) public eva_idp_planService(IBaseRepository2<eva_idp_planEntity, int> repository, IMyDatabase mydb, Iexternal_linkageService inext)
{ {
_repository = repository; _repository = repository;
db = mydb; db = mydb;
ext = inext; ext = inext;
} }
#region Private Functions #region Private Functions
@@ -77,18 +77,18 @@ namespace TodoAPI2.Models
public List<eva_idp_planViewModel> GetListBycreate_evaluation_detail_id(int? create_evaluation_detail_id) public List<eva_idp_planViewModel> GetListBycreate_evaluation_detail_id(int? create_evaluation_detail_id)
{ {
var model = new eva_idp_planSearchModel(); var model = new eva_idp_planSearchModel();
model.create_evaluation_detail_id = create_evaluation_detail_id; model.create_evaluation_detail_id = create_evaluation_detail_id;
return GetListBySearch(model); return GetListBySearch(model);
} }
public List<eva_idp_planViewModel> GetListBySearch(eva_idp_planSearchModel model) public List<eva_idp_planViewModel> GetListBySearch(eva_idp_planSearchModel model)
{ {
var data = ( var data = (
from m_eva_idp_plan in _repository.Context.eva_idp_plan from m_eva_idp_plan in _repository.Context.eva_idp_plan
where 1==1 where 1 == 1
//&& (m_eva_idp_plan.id == model.id || !model.id.HasValue) //&& (m_eva_idp_plan.id == model.id || !model.id.HasValue)
&& (m_eva_idp_plan.create_evaluation_detail_id == model.create_evaluation_detail_id || !model.create_evaluation_detail_id.HasValue) && (m_eva_idp_plan.create_evaluation_detail_id == model.create_evaluation_detail_id || !model.create_evaluation_detail_id.HasValue)
@@ -122,10 +122,10 @@ namespace TodoAPI2.Models
int? newkey = 0; int? newkey = 0;
var x = (from i in _repository.Context.eva_idp_plan var x = (from i in _repository.Context.eva_idp_plan
orderby i.id descending orderby i.id descending
select i).Take(1).ToList(); select i).Take(1).ToList();
if(x.Count > 0) if (x.Count > 0)
{ {
newkey = x[0].id + 1; newkey = x[0].id + 1;
} }
@@ -161,23 +161,23 @@ namespace TodoAPI2.Models
return Get(updated.id); return Get(updated.id);
} }
else else
throw new NotificationException("No data to update"); throw new NotificationException("No data to update");
} }
public string UpdateMultiple(List<eva_idp_planInputModel> model) public string UpdateMultiple(List<eva_idp_planInputModel> model)
{ {
foreach(var i in model) foreach (var i in model)
{ {
if (i.active_mode == "1" && i.id.HasValue) // update if (i.active_mode == "1" && i.id.HasValue) // update
{ {
var existingEntity = _repository.Get(i.id.Value); var existingEntity = _repository.Get(i.id.Value);
if (existingEntity != null) if (existingEntity != null)
{ {
existingEntity.create_evaluation_detail_id = i.create_evaluation_detail_id; existingEntity.create_evaluation_detail_id = i.create_evaluation_detail_id;
existingEntity.develop = i.develop; existingEntity.develop = i.develop;
existingEntity.development_method = i.development_method; existingEntity.development_method = i.development_method;
existingEntity.start_date = i.start_date; existingEntity.start_date = i.start_date;
existingEntity.end_date = i.end_date; existingEntity.end_date = i.end_date;
_repository.UpdateWithoutCommit(i.id.Value, existingEntity); _repository.UpdateWithoutCommit(i.id.Value, existingEntity);
@@ -198,7 +198,7 @@ namespace TodoAPI2.Models
// nothing to do // nothing to do
} }
} }
_repository.Context.SaveChanges(); _repository.Context.SaveChanges();
return model.Count().ToString(); return model.Count().ToString();
} }

View File

@@ -20,14 +20,14 @@ namespace TodoAPI2.Models
public class eva_idp_plan_ownerService : Ieva_idp_plan_ownerService public class eva_idp_plan_ownerService : Ieva_idp_plan_ownerService
{ {
private IBaseRepository2<eva_idp_planEntity, int> _repository; private IBaseRepository2<eva_idp_planEntity, int> _repository;
private IMyDatabase db; private IMyDatabase db;
private Iexternal_linkageService ext; private Iexternal_linkageService ext;
public eva_idp_plan_ownerService(IBaseRepository2<eva_idp_planEntity, int> repository, IMyDatabase mydb, Iexternal_linkageService inext) public eva_idp_plan_ownerService(IBaseRepository2<eva_idp_planEntity, int> repository, IMyDatabase mydb, Iexternal_linkageService inext)
{ {
_repository = repository; _repository = repository;
db = mydb; db = mydb;
ext = inext; ext = inext;
} }
#region Private Functions #region Private Functions
@@ -77,18 +77,18 @@ namespace TodoAPI2.Models
public List<eva_idp_plan_ownerViewModel> GetListBycreate_evaluation_detail_id(int? create_evaluation_detail_id) public List<eva_idp_plan_ownerViewModel> GetListBycreate_evaluation_detail_id(int? create_evaluation_detail_id)
{ {
var model = new eva_idp_plan_ownerSearchModel(); var model = new eva_idp_plan_ownerSearchModel();
model.create_evaluation_detail_id = create_evaluation_detail_id; model.create_evaluation_detail_id = create_evaluation_detail_id;
return GetListBySearch(model); return GetListBySearch(model);
} }
public List<eva_idp_plan_ownerViewModel> GetListBySearch(eva_idp_plan_ownerSearchModel model) public List<eva_idp_plan_ownerViewModel> GetListBySearch(eva_idp_plan_ownerSearchModel model)
{ {
var data = ( var data = (
from m_eva_idp_plan_owner in _repository.Context.eva_idp_plan from m_eva_idp_plan_owner in _repository.Context.eva_idp_plan
where 1==1 where 1 == 1
//&& (m_eva_idp_plan_owner.id == model.id || !model.id.HasValue) //&& (m_eva_idp_plan_owner.id == model.id || !model.id.HasValue)
&& (m_eva_idp_plan_owner.create_evaluation_detail_id == model.create_evaluation_detail_id || !model.create_evaluation_detail_id.HasValue) && (m_eva_idp_plan_owner.create_evaluation_detail_id == model.create_evaluation_detail_id || !model.create_evaluation_detail_id.HasValue)
@@ -122,10 +122,10 @@ namespace TodoAPI2.Models
int? newkey = 0; int? newkey = 0;
var x = (from i in _repository.Context.eva_idp_plan var x = (from i in _repository.Context.eva_idp_plan
orderby i.id descending orderby i.id descending
select i).Take(1).ToList(); select i).Take(1).ToList();
if(x.Count > 0) if (x.Count > 0)
{ {
newkey = x[0].id + 1; newkey = x[0].id + 1;
} }
@@ -139,7 +139,7 @@ namespace TodoAPI2.Models
entity.id = GetNewPrimaryKey(); entity.id = GetNewPrimaryKey();
entity.SetAutoField(_repository.Context);
var inserted = _repository.Insert(entity); var inserted = _repository.Insert(entity);
return Get(inserted.id); return Get(inserted.id);
@@ -156,30 +156,30 @@ namespace TodoAPI2.Models
existingEntity.start_date = model.start_date; existingEntity.start_date = model.start_date;
existingEntity.end_date = model.end_date; existingEntity.end_date = model.end_date;
existingEntity.SetAutoField(_repository.Context);
var updated = _repository.Update(id, existingEntity); var updated = _repository.Update(id, existingEntity);
return Get(updated.id); return Get(updated.id);
} }
else else
throw new NotificationException("No data to update"); throw new NotificationException("No data to update");
} }
public string UpdateMultiple(List<eva_idp_plan_ownerInputModel> model) public string UpdateMultiple(List<eva_idp_plan_ownerInputModel> model)
{ {
foreach(var i in model) foreach (var i in model)
{ {
if (i.active_mode == "1" && i.id.HasValue) // update if (i.active_mode == "1" && i.id.HasValue) // update
{ {
var existingEntity = _repository.Get(i.id.Value); var existingEntity = _repository.Get(i.id.Value);
if (existingEntity != null) if (existingEntity != null)
{ {
existingEntity.create_evaluation_detail_id = i.create_evaluation_detail_id; existingEntity.create_evaluation_detail_id = i.create_evaluation_detail_id;
existingEntity.develop = i.develop; existingEntity.develop = i.develop;
existingEntity.development_method = i.development_method; existingEntity.development_method = i.development_method;
existingEntity.start_date = i.start_date; existingEntity.start_date = i.start_date;
existingEntity.end_date = i.end_date; existingEntity.end_date = i.end_date;
existingEntity.SetAutoField(_repository.Context);
_repository.UpdateWithoutCommit(i.id.Value, existingEntity); _repository.UpdateWithoutCommit(i.id.Value, existingEntity);
} }
} }
@@ -187,6 +187,7 @@ namespace TodoAPI2.Models
{ {
var entity = GetEntity(i); var entity = GetEntity(i);
entity.id = GetNewPrimaryKey(); entity.id = GetNewPrimaryKey();
entity.SetAutoField(_repository.Context);
_repository.InsertWithoutCommit(entity); _repository.InsertWithoutCommit(entity);
} }
else if (i.active_mode == "0" && i.id.HasValue) // remove else if (i.active_mode == "0" && i.id.HasValue) // remove
@@ -198,7 +199,7 @@ namespace TodoAPI2.Models
// nothing to do // nothing to do
} }
} }
_repository.Context.SaveChanges(); _repository.Context.SaveChanges();
return model.Count().ToString(); return model.Count().ToString();
} }
@@ -222,7 +223,7 @@ namespace TodoAPI2.Models
return; return;
} }
private Dictionary<string,string> GetLookupForLog() private Dictionary<string, string> GetLookupForLog()
{ {
var i = new Dictionary<string, string>(); var i = new Dictionary<string, string>();
@@ -247,3 +248,4 @@ namespace TodoAPI2.Models
#endregion #endregion
} }
} }

View File

@@ -35,14 +35,14 @@ namespace TodoAPI2.Models
public int? selected_round { get; set; } public int? selected_round { get; set; }
public string round1_text { get; set; } public string round1_text { get; set; }
public string round2_text { get; set; } public string round2_text { get; set; }
public decimal? total_summary_supervisor2A { get; set; } public decimal? total_summary_supervisor2a { get; set; }
public decimal? Final_summary_supervisor2A { get; set; } public decimal? final_summary_supervisor2a { get; set; }
public decimal? total_summary_competency_supervisor2A { get; set; } public decimal? total_summary_competency_supervisor2a { get; set; }
public decimal? Final_summary_competency_supervisor2A { get; set; } public decimal? final_summary_competency_supervisor2a { get; set; }
public decimal? achievement_supervisor2A { get; set; } public decimal? achievement_supervisor2a { get; set; }
public decimal? competency_supervisor2A { get; set; } public decimal? competency_supervisor2a { get; set; }
public decimal? score_supervisor2A { get; set; } public decimal? score_supervisor2a { get; set; }
public string level_score_supervisor2A { get; set; } public string level_score_supervisor2a { get; set; }
public decimal? w1 { get; set; } public decimal? w1 { get; set; }
public decimal? w2 { get; set; } public decimal? w2 { get; set; }

View File

@@ -255,6 +255,15 @@ public class MyHelper
+ (d.Month < 10 ? "0" + d.Month.ToString() : d.Month.ToString()) + "-" + (d.Month < 10 ? "0" + d.Month.ToString() : d.Month.ToString()) + "-"
+ (d.Day < 10 ? "0" + d.Day.ToString() : d.Day.ToString()); + (d.Day < 10 ? "0" + d.Day.ToString() : d.Day.ToString());
} }
if (propertyInfo.PropertyType.ToString().Contains("Decimal")
|| propertyInfo.PropertyType.ToString().Contains("Double")
|| propertyInfo.PropertyType.ToString().Contains("Float"))
{
if(value != null)
{
value = ((decimal)value).ToString("0.#####");
}
}
parameter += propertyInfo.Name + "=" + value; parameter += propertyInfo.Name + "=" + value;
} }
} }

View File

@@ -106,20 +106,20 @@
<td colspan="2">ลาป่วย</td> <td colspan="2">ลาป่วย</td>
<td colspan="2">ลากิจ</td> <td colspan="2">ลากิจ</td>
<td rowspan="2">ลาพักผ่อน</td> <td rowspan="2">ลาพักผ่อน</td>
<td rowspan="2">ขอกลับก่อนเวลา</td> <td rowspan="2">ขอกลับ<br/>ก่อนเวลา</td>
<td>สาย</td> <td>สาย</td>
<td>ขาด</td> <td>ขาด</td>
<td colspan="2">รวม (ป่วย/กิจ)</td> <td colspan="2">รวม (ป่วย/กิจ)</td>
</tr> </tr>
<tr> <tr>
<td>วัน</td> <td width="10%">วัน</td>
<td>ครั้ง</td> <td width="10%">ครั้ง</td>
<td>วัน</td> <td width="10%">วัน</td>
<td>ครั้ง</td> <td width="10%">ครั้ง</td>
<td>สาย</td> <td width="10%">สาย</td>
<td>ขาด</td> <td width="10%">ขาด</td>
<td>วัน</td> <td width="10%">วัน</td>
<td>ครั้ง</td> <td width="10%">ครั้ง</td>
</tr> </tr>
<tr> <tr>
<td><p id="sum_day_sick_leave"></p></td> @*ลาป่วย วัน*@ <td><p id="sum_day_sick_leave"></p></td> @*ลาป่วย วัน*@

View File

@@ -156,20 +156,20 @@
<td colspan="2">ลาป่วย</td> <td colspan="2">ลาป่วย</td>
<td colspan="2">ลากิจ</td> <td colspan="2">ลากิจ</td>
<td rowspan="2">ลาพักผ่อน</td> <td rowspan="2">ลาพักผ่อน</td>
<td rowspan="2">ขอกลับก่อนเวลา</td> <td rowspan="2">ขอกลับ<br/>ก่อนเวลา</td>
<td>สาย</td> <td>สาย</td>
<td>ขาด</td> <td>ขาด</td>
<td colspan="2">รวม (ป่วย/กิจ)</td> <td colspan="2">รวม (ป่วย/กิจ)</td>
</tr> </tr>
<tr> <tr>
<td>วัน</td> <td width="10%">วัน</td>
<td>ครั้ง</td> <td width="10%">ครั้ง</td>
<td>วัน</td> <td width="10%">วัน</td>
<td>ครั้ง</td> <td width="10%">ครั้ง</td>
<td>สาย</td> <td width="10%">สาย</td>
<td>ขาด</td> <td width="10%">ขาด</td>
<td>วัน</td> <td width="10%">วัน</td>
<td>ครั้ง</td> <td width="10%">ครั้ง</td>
</tr> </tr>
<tr> <tr>
<td><p id="sum_day_sick_leave"></p></td> @*ลาป่วย วัน*@ <td><p id="sum_day_sick_leave"></p></td> @*ลาป่วย วัน*@

View File

@@ -45,6 +45,7 @@ function rep_eva_x_DoSearch(fileType, data) {
var report_url = apisite + "/api/rep_eva_x/rep_eva_x_report?" + p; var report_url = apisite + "/api/rep_eva_x/rep_eva_x_report?" + p;
if (fileType === "pdf") { if (fileType === "pdf") {
$("#report_result").attr("src", "");
$("#report_result").attr("src", report_url); $("#report_result").attr("src", report_url);
$("#report_result").show(); $("#report_result").show();
//window.open(report_url); //window.open(report_url);