Renamed columns in ActivityChecklist
This commit is contained in:
parent
f906e8f7d0
commit
c7304dc80b
@ -325,8 +325,8 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
ActivityMasterId = table.Column<int>(type: "int", nullable: false),
|
||||
Check = table.Column<string>(type: "longtext", nullable: true)
|
||||
ActivityId = table.Column<int>(type: "int", nullable: false),
|
||||
Description = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
IsChecked = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
IsMandatory = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
|
@ -15,7 +15,7 @@ namespace Marco.Pms.Model.Activities
|
||||
public TaskAllocation? TaskAllocation { get; set; }
|
||||
|
||||
public DateTime CommentDate { get; set; }
|
||||
public string Comment { get; set; }
|
||||
public string Comment { get; set; } = string.Empty;
|
||||
public int CommentedBy { get; set; }
|
||||
[ForeignKey("CommentedBy")]
|
||||
[ValidateNever]
|
||||
|
@ -3,7 +3,7 @@
|
||||
public class CreateCheckListDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string? Check { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public bool IsMandatory { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
public class ReportCheckListDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string? Check { get; set; }
|
||||
public string Description { get; set; }= string.Empty;
|
||||
public bool IsMandatory { get; set; }
|
||||
public bool IsChecked { get; set; }
|
||||
}
|
||||
|
@ -3,8 +3,8 @@
|
||||
public class ActivityCheckList
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int ActivityMasterId { get; set; }
|
||||
public string? Check { get; set; }
|
||||
public int ActivityId { get; set; }
|
||||
public string? Description { get; set; } = string.Empty;
|
||||
public bool IsChecked { get; set; } = false;
|
||||
public bool IsMandatory { get; set; }
|
||||
public int TenantId { get; set; }
|
||||
|
@ -138,8 +138,8 @@ namespace Marco.Pms.Model.Mapper
|
||||
return new CheckListVM
|
||||
{
|
||||
Id = checkList.Id,
|
||||
Check = checkList.Check,
|
||||
ActivityMasterId = activityId,
|
||||
Description = checkList.Description,
|
||||
ActivityId = activityId,
|
||||
IsChecked = IsChecked,
|
||||
IsMandatory = checkList.IsMandatory,
|
||||
};
|
||||
@ -149,8 +149,8 @@ namespace Marco.Pms.Model.Mapper
|
||||
return new ActivityCheckList
|
||||
{
|
||||
Id = checkListDto.Id,
|
||||
Check = checkListDto.Check,
|
||||
ActivityMasterId = activityId,
|
||||
Description = checkListDto.Description,
|
||||
ActivityId = activityId,
|
||||
IsMandatory = checkListDto.IsMandatory,
|
||||
TenantId = tenantId
|
||||
};
|
||||
@ -160,8 +160,8 @@ namespace Marco.Pms.Model.Mapper
|
||||
return new CheckListVM
|
||||
{
|
||||
Id = checkListDto.Id,
|
||||
Check = checkListDto.Check,
|
||||
ActivityMasterId = activityId,
|
||||
Description = checkListDto.Description,
|
||||
ActivityId = activityId,
|
||||
IsChecked = checkListDto.IsChecked,
|
||||
IsMandatory = checkListDto.IsMandatory,
|
||||
};
|
||||
|
@ -3,8 +3,8 @@
|
||||
public class CheckListVM
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int ActivityMasterId { get; set; }
|
||||
public string? Check { get; set; }
|
||||
public int ActivityId { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public bool IsChecked { get; set; }
|
||||
public bool IsMandatory { get; set; }
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ namespace Marco.Pms.Services.Controllers
|
||||
var activities = await _context.ActivityMasters.Where(c => c.TenantId == tenantId && c.IsActive == true).ToListAsync();
|
||||
List<ActivityVM> activitiesVM = new List<ActivityVM>();
|
||||
foreach (var activity in activities) {
|
||||
var checkList = await _context.ActivityCheckLists.Where(c => c.TenantId == tenantId && c.ActivityMasterId == activity.Id).ToListAsync();
|
||||
var checkList = await _context.ActivityCheckLists.Where(c => c.TenantId == tenantId && c.ActivityId == activity.Id).ToListAsync();
|
||||
List<CheckListVM> checkListVM = new List<CheckListVM>();
|
||||
if(checkList != null)
|
||||
{
|
||||
|
@ -235,18 +235,18 @@ namespace MarcoBMS.Services.Controllers
|
||||
{
|
||||
commentVM.Add(comment.ToCommentVMFromTaskComment());
|
||||
}
|
||||
List<ActivityCheckList> checkLists = await _context.ActivityCheckLists.Where(x => x.ActivityMasterId == taskAllocation.WorkItem.ActivityId).ToListAsync();
|
||||
List<ActivityCheckList> checkLists = await _context.ActivityCheckLists.Where(x => x.ActivityId == taskAllocation.WorkItem.ActivityId).ToListAsync();
|
||||
List<CheckListMappings> checkListMappings = await _context.CheckListMappings.Where(c => c.TaskAllocationId == taskAllocation.Id).ToListAsync();
|
||||
List<CheckListVM>checkList = new List<CheckListVM>();
|
||||
foreach (var check in checkLists) {
|
||||
var checkListMapping = checkListMappings.Find(c => c.CheckListId == check.Id);
|
||||
if(checkListMapping != null)
|
||||
{
|
||||
checkList.Add(check.ToCheckListVMFromActivityCheckList(check.ActivityMasterId, true));
|
||||
checkList.Add(check.ToCheckListVMFromActivityCheckList(check.ActivityId, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
checkList.Add(check.ToCheckListVMFromActivityCheckList(check.ActivityMasterId, false));
|
||||
checkList.Add(check.ToCheckListVMFromActivityCheckList(check.ActivityId, false));
|
||||
}
|
||||
}
|
||||
response.comments = commentVM;
|
||||
|
Loading…
x
Reference in New Issue
Block a user