public ShiftManagementDetailModel(ShiftManagementDetail fromEntity, Dictionary <int, string> managerList)
        {
            Employee = new EmployeeInfoModel
            {
                FullName   = fromEntity.Employee.LookupValue,
                Id         = fromEntity.Employee.LookupId,
                EmployeeId = fromEntity.EmployeeID != null ? fromEntity.EmployeeID.LookupValue : string.Empty
            };

            Employee.ManagerName = managerList[Convert.ToInt32(Employee.Id)];

            Id = fromEntity.ID;
            ShiftManagementID = fromEntity.ShiftManagementID.LookupId;

            for (int i = 1; i <= 31; i++)
            {
                var shiftTimePropertyName       = string.Format("ShiftTime{0}", i);
                var shiftTime                   = GetType().GetProperty(shiftTimePropertyName);
                var shiftTimeFromEntity         = fromEntity.GetType().GetProperty(string.Format("ShiftTime{0}", i.ToString())).GetValue(fromEntity) as LookupItem;
                var shiftTimeApprovedFromEntity = fromEntity.GetType().GetProperty(string.Format("ShiftTime{0}Approval", i.ToString())).GetValue(fromEntity);
                var shiftValue                  = new ShiftTimeDetailModel();
                if (shiftTimeFromEntity != null)
                {
                    shiftValue.Value    = shiftTimeFromEntity.LookupId.ToString();
                    shiftValue.Code     = shiftTimeFromEntity.LookupValue;
                    shiftValue.Approved = shiftTimeApprovedFromEntity != null ? (bool)shiftTimeApprovedFromEntity : false;
                }
                shiftTime.SetValue(this, shiftValue);
            }
        }
 public ShiftManagementDetailModel()
 {
     Employee     = new EmployeeInfoModel();
     ShiftTime1   = new ShiftTimeDetailModel();
     ShiftTime2   = new ShiftTimeDetailModel();
     ShiftTime3   = new ShiftTimeDetailModel();
     ShiftTime4   = new ShiftTimeDetailModel();
     ShiftTime5   = new ShiftTimeDetailModel();
     ShiftTime6   = new ShiftTimeDetailModel();
     ShiftTime7   = new ShiftTimeDetailModel();
     ShiftTime8   = new ShiftTimeDetailModel();
     ShiftTime9   = new ShiftTimeDetailModel();
     ShiftTime10  = new ShiftTimeDetailModel();
     ShiftTime11  = new ShiftTimeDetailModel();
     ShiftTime12  = new ShiftTimeDetailModel();
     ShiftTime13  = new ShiftTimeDetailModel();
     ShiftTime14  = new ShiftTimeDetailModel();
     ShiftTime15  = new ShiftTimeDetailModel();
     ShiftTime16  = new ShiftTimeDetailModel();
     ShiftTime17  = new ShiftTimeDetailModel();
     ShiftTime18  = new ShiftTimeDetailModel();
     ShiftTime19  = new ShiftTimeDetailModel();
     ShiftTime20  = new ShiftTimeDetailModel();
     ShiftTime21  = new ShiftTimeDetailModel();
     ShiftTime22  = new ShiftTimeDetailModel();
     ShiftTime23  = new ShiftTimeDetailModel();
     ShiftTime24  = new ShiftTimeDetailModel();
     ShiftTime25  = new ShiftTimeDetailModel();
     ShiftTime26  = new ShiftTimeDetailModel();
     ShiftTime27  = new ShiftTimeDetailModel();
     ShiftTime28  = new ShiftTimeDetailModel();
     ShiftTime29  = new ShiftTimeDetailModel();
     ShiftTime30  = new ShiftTimeDetailModel();
     ShiftTime31  = new ShiftTimeDetailModel();
     ApprovalDays = new List <ApprovalDayInfo>();
 }