เตรียม UI รายงานแบบประเมิน
This commit is contained in:
@@ -21,7 +21,7 @@ namespace TodoAPI2.Models
|
||||
eva_idp_planWithSelectionViewModel GetWithSelection(int id);
|
||||
eva_idp_planWithSelectionViewModel GetBlankItem();
|
||||
|
||||
|
||||
void RefreshAutoFieldOfAllData();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,6 @@ namespace TodoAPI2.Models
|
||||
{
|
||||
public class eva_idp_planEntity : BaseEntity2<int>
|
||||
{
|
||||
|
||||
|
||||
public int? create_evaluation_detail_id { get; set; }
|
||||
|
||||
[MaxLength(1000)]
|
||||
@@ -28,6 +26,25 @@ namespace TodoAPI2.Models
|
||||
|
||||
public DateTime? end_date { get; set; }
|
||||
|
||||
[MaxLength(1000)]
|
||||
public string period_text { get; set; }
|
||||
|
||||
public void SetAutoField(DataContext context)
|
||||
{
|
||||
string temp = "";
|
||||
if (start_date.HasValue)
|
||||
{
|
||||
temp = MyHelper.GetDateStringForReport(start_date);
|
||||
}
|
||||
if (end_date.HasValue)
|
||||
{
|
||||
temp += " ถึง " + MyHelper.GetDateStringForReport(end_date);
|
||||
}
|
||||
}
|
||||
|
||||
public void DoAfterInsertUpdate(DataContext context)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace TodoAPI2.Models
|
||||
entity.id = GetNewPrimaryKey();
|
||||
|
||||
|
||||
|
||||
entity.SetAutoField(_repository.Context);
|
||||
var inserted = _repository.Insert(entity);
|
||||
|
||||
return Get(inserted.id);
|
||||
@@ -156,7 +156,7 @@ namespace TodoAPI2.Models
|
||||
existingEntity.start_date = model.start_date;
|
||||
existingEntity.end_date = model.end_date;
|
||||
|
||||
|
||||
existingEntity.SetAutoField(_repository.Context);
|
||||
var updated = _repository.Update(id, existingEntity);
|
||||
return Get(updated.id);
|
||||
}
|
||||
@@ -228,5 +228,16 @@ namespace TodoAPI2.Models
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
public void RefreshAutoFieldOfAllData()
|
||||
{
|
||||
var all_items = from i in _repository.Context.eva_idp_plan
|
||||
select i;
|
||||
foreach (var item in all_items)
|
||||
{
|
||||
item.SetAutoField(_repository.Context);
|
||||
}
|
||||
_repository.Context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user