Tried the above. No effect. Same output. Also, why is the above proposed? Why do methods and classes generated with the AspNetZero Entity Generator enable the accurate server-proxy code, but those created manually do not?
GetSeatGridInput.cs
using Abp.Application.Services.Dto;
namespace ngTTM.TtmDataModel.Dtos
{
public class GetSeatGridInput : EntityDto<int?>
{
public int RoomId { get; set; }
public int ScheduleId { get; set; }
public int StudentId { get; set; }
public int DayOfYearToday { get; set; }
}
}
SeatsAppService.cs:
public async Task<TtmSeatGridDto> GetSeatGrid(GetSeatGridInput seatGridFilter)
{
string roomIdFilter = seatGridFilter.RoomId.ToString();
TtmSeatGridDto ttmSeatGridDto = new TtmSeatGridDto();
ttmSeatGridDto.seatList = await GetTtmSeatsDto(
new GetAllSeatsInput()
{
SeatTagFilter = null,
RoomIdFilter = roomIdFilter,
RoomRoomNameFilter = null,
MaxResultCount = 1000,
});
ttmSeatGridDto.seatListIndex = new int[ttmSeatGridDto.seatList[0].Count - 1];
// 0 is the frozen column, so list must start with 1
for (int ndx = 0; ndx < ttmSeatGridDto.seatList[0].Count - 1; ndx++)
{
ttmSeatGridDto.seatListIndex[ndx] = ndx + 1;
}
ttmSeatGridDto.seatCount = _seatRepository.Count(s => s.Room.Id.ToString() == roomIdFilter && s.SeatType != SeatType.None);
Seat seatR = _seatRepository.FirstOrDefault(s => s.Room.Id.ToString() == roomIdFilter);
Seat seatA = await _seatRepository.FirstOrDefaultAsync(s => s.Room.Id.ToString() == roomIdFilter);
Room room = _roomRepository.FirstOrDefault(r => r.Id == seatR.RoomId);
ttmSeatGridDto.SeatsPerRowView = Math.Min(room.SeatsPerRowView, room.SeatsPerRow);
return ttmSeatGridDto;
}
seatAssignmentAppService.cs:
using Abp.Application.Services.Dto;
using Abp.Authorization;
using Abp.Domain.Repositories;
using Abp.Linq.Extensions;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using ngTTM.Authorization;
using ngTTM.TtmDataModel.Dtos;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
namespace ngTTM.TtmDataModel
{
//#############################################################################################
[AbpAuthorize(AppPermissions.Pages_SeatAssignments)]
public class SeatAssignmentsAppService : ngTTMAppServiceBase
{
//=========================================================================================
#region Private Fields
//-----------------------------------------------------------------------------------------
private readonly IRepository<ClassRoster> _classRosterRepository;
private readonly ClassRostersAppService _classRostersAppService;
private readonly IRepository<Room, int> _roomRepository;
private readonly IRepository<Schedule, int> _scheduleRepository;
private readonly SeatsAppService _seatAppService;
private readonly IRepository<SeatAssignment> _seatAssignmentRepository;
private readonly IRepository<Seat, int> _seatRepository;
private readonly IRepository<Student, int> _studentRepository;
private readonly StudentsAppService _studentsAppService;
private readonly IRepository<Term> _termRepository;
private readonly string entityName;
private readonly string initstatus;
//-----------------------------------------------------------------------------------------
#endregion Private Fields
//=========================================================================================
#region Public Constructors
//-----------------------------------------------------------------------------------------
public SeatAssignmentsAppService(
IRepository<SeatAssignment> seatAssignmentRepository,
IRepository<Schedule, int> scheduleRepository,
IRepository<Student, int> studentRepository,
IRepository<Seat, int> seatRepository,
IRepository<ClassRoster> classRosterRepository,
IRepository<Room, int> roomRepository,
IRepository<Term> termRepository,
ClassRostersAppService classRostersAppService,
StudentsAppService studentsAppService,
SeatsAppService seatAppService
)
{
_seatAssignmentRepository = seatAssignmentRepository;
_scheduleRepository = scheduleRepository;
_studentRepository = studentRepository;
_seatRepository = seatRepository;
_classRosterRepository = classRosterRepository;
_roomRepository = roomRepository;
_termRepository = termRepository;
_classRostersAppService = classRostersAppService;
_seatAppService = seatAppService;
_studentsAppService = studentsAppService;
entityName = L("SeatAssignment");
initstatus = L("Success");
}
//-----------------------------------------------------------------------------------------
#endregion Public Constructors
//=========================================================================================
//-----------------------------------------------------------------------------------------
public async Task<TtmSeatGridDto> GetSeatGrid(GetSeatGridInput seatGridFilter)
{
TtmSeatGridDto ttmSeatGridDto = await _seatAppService.GetSeatGrid(seatGridFilter);
// get all Assigned Seats in the specified Section
List<int> assignedSeats = await GetAssignedSeatsList(seatGridFilter.ScheduleId);
int totalAbsent = 0;
int totalNotRecorded = 0;
int totalPresent = 0;
int totalTardy = 0;
foreach (List<TtmSeatsDto> seatRow in ttmSeatGridDto.seatList)
{
foreach (TtmSeatsDto seat in seatRow)
{
if (assignedSeats.Contains(seat.seatId))
{
SeatAssignment seatassn =
await _seatAssignmentRepository.FirstOrDefaultAsync(s => s.SeatId == seat.seatId);
int doyIndex = seatassn.Schedule.GetMeetingDayOfYearIndex(seatGridFilter.DayOfYearToday);
AttendanceStatus? todayStatus = null;
if (doyIndex > 0 && seatassn.AttendanceStatusCount >= doyIndex - 1)
{
todayStatus = seatassn.AttendanceStatuses[doyIndex];
switch (todayStatus)
{
case AttendanceStatus.Absent:
totalAbsent++;
break;
case AttendanceStatus.NotRecorded:
totalNotRecorded++;
break;
case AttendanceStatus.Present:
totalPresent++;
break;
case AttendanceStatus.Tardy:
totalTardy++;
break;
}
}
Student student =
await _studentRepository.FirstOrDefaultAsync(s => s.Id == seatassn.StudentId);
seat.isAssigned = true;
seat.seatAssignmentId = seatassn.Id;
seat.studentId = student.Id;
seat.studentName = student.StudentName;
seat.seatPreference = student.SeatPreference;
seat.studentPhotoBase64 =
await _studentsAppService.GetStudentPhotoById(student.StudentPhotoId);
seat.attendanceStatus = todayStatus;
seat.firstName = student.FirstName;
seat.lastName = student.LastName;
seat.daysAbsent = seatassn.StatusCount(AttendanceStatus.Absent);
seat.daysNotRecorded = seatassn.StatusCount(AttendanceStatus.NotRecorded);
seat.daysPresent = seatassn.StatusCount(AttendanceStatus.Present);
seat.daysTardy = seatassn.StatusCount(AttendanceStatus.Tardy);
seat.daysTotal = seatassn.AttendanceStatusCount;
seat.studentInteractions = seatassn.StudentInteractions;
seat.studentNotes = seatassn.StudentNotes;
}
}
}
ttmSeatGridDto.classroomSeats = new TtmSeatsDto();
ttmSeatGridDto.classroomSeats.daysAbsent = totalAbsent;
ttmSeatGridDto.classroomSeats.daysNotRecorded = totalNotRecorded;
ttmSeatGridDto.classroomSeats.daysPresent = totalPresent;
ttmSeatGridDto.classroomSeats.daysTardy = totalTardy;
ttmSeatGridDto.classroomSeats.daysTotal = totalAbsent + totalNotRecorded + totalPresent + totalTardy;
ttmSeatGridDto.IsExistAttendanceRecordForToday =
await IsExistAttendanceRecordForToday(seatGridFilter.ScheduleId,
seatGridFilter.DayOfYearToday);
return ttmSeatGridDto;
}
//-----------------------------------------------------------------------------------------
TtmSeats.Dto.cs
namespace ngTTM.TtmDataModel.Dtos
{
public class TtmSeatsDto
{
public int seatId { get; set; }
public int studentId { get; set; }
public int seatAssignmentId { get; set; }
public int actualRow { get; set; }
public int actualSeat{ get; set; }
public int daysPresent { get; set; }
public int daysAbsent { get; set; }
public int daysTardy { get; set; }
public int daysNotRecorded { get; set; }
public int daysTotal { get; set; }
public int studentInteractions { get; set; }
public string studentNotes { get; set; }
public string seatTag { get; set; }
public string rowLetter { get; set; }
public string firstName { get; set; }
public string lastName { get; set; }
public string studentName { get; set; }
public string studentPhotoBase64 { get; set; }
public SeatType seatType { get; set; }
public SeatType seatPreference { get; set; }
public AttendanceStatus? attendanceStatus { get; set; }
public bool isAssigned { get; set; }
public string dragOverClass { get; set; }
public TtmSeatsDto() { }
public TtmSeatsDto(
int _seatId,
int _studentId,
int _actualRow,
int _actualSeat,
bool _isAssigned,
string _rowLetter,
string _seatTag,
string _firstName,
string _lastName,
string _studentName,
SeatType _seatType,
SeatType _studentSeatpreference,
AttendanceStatus? _attendanceStatus
)
{
seatId = _seatId;
actualRow = _actualRow;
actualSeat = _actualSeat;
rowLetter = _rowLetter;
seatTag = _seatTag;
firstName = _firstName;
lastName = _lastName;
studentName = _studentName;
seatType = _seatType;
isAssigned = _isAssigned;
studentId = _studentId;
seatPreference = _studentSeatpreference;
attendanceStatus = _attendanceStatus;
dragOverClass = "";
}
}
}
Generated code:
/**
* @param roomId (optional)
* @param scheduleId (optional)
* @param studentId (optional)
* @param dayOfYearToday (optional)
* @param id (optional)
* @return Success
*/
getSeatGrid(roomId: number | null | undefined, scheduleId: number | null | undefined, studentId: number | null | undefined, dayOfYearToday: number | null | undefined, id: number | null | undefined): Observable<TtmSeatGridDto> {
let url_ = this.baseUrl + "/api/services/app/SeatAssignments/GetSeatGrid?";
if (roomId !== undefined)
url_ += "RoomId=" + encodeURIComponent("" + roomId) + "&";
if (scheduleId !== undefined)
url_ += "ScheduleId=" + encodeURIComponent("" + scheduleId) + "&";
if (studentId !== undefined)
url_ += "StudentId=" + encodeURIComponent("" + studentId) + "&";
if (dayOfYearToday !== undefined)
url_ += "DayOfYearToday=" + encodeURIComponent("" + dayOfYearToday) + "&";
if (id !== undefined)
url_ += "Id=" + encodeURIComponent("" + id) + "&";
url_ = url_.replace(/[?&]$/, "");
let options_ : any = {
observe: "response",
responseType: "blob",
headers: new HttpHeaders({
"Accept": "application/json"
})
};
return this.http.request("get", url_, options_).pipe(_observableMergeMap((response_ : any) => {
return this.processGetSeatGrid(response_);
})).pipe(_observableCatch((response_: any) => {
if (response_ instanceof HttpResponseBase) {
try {
return this.processGetSeatGrid(<any>response_);
} catch (e) {
return <Observable<TtmSeatGridDto>><any>_observableThrow(e);
}
} else
return <Observable<TtmSeatGridDto>><any>_observableThrow(response_);
}));
}
protected processGetSeatGrid(response: HttpResponseBase): Observable<TtmSeatGridDto> {
const status = response.status;
const responseBlob =
response instanceof HttpResponse ? response.body :
(<any>response).error instanceof Blob ? (<any>response).error : undefined;
let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }};
if (status === 200) {
return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {
let result200: any = null;
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result200 = resultData200 ? TtmSeatGridDto.fromJS(resultData200) : new TtmSeatGridDto();
return _observableOf(result200);
}));
} else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return _observableOf<TtmSeatGridDto>(<any>null);
}
Refresh.bat exports CreateOrEdit(CreateOrEditXDto input)
as export class CreateOrEditXDto implements ICreateOrEditXDto
in 'service-proxies.ts' when run. This is correct.
I created a new public method in the same service, and used 'CreateOrEdit' as model - a method with a class containing multiple properties as the only parameter. All new files are in the same folders as the model method. However, the new method and parameter is not exported correctly in 'service-proxies.ts' - the new method is defined as a call with individual parameters for each of the class properties.
What additional information does Refresh.bat need to correctly export the class parameter of my new public method?
running npm run create-bundles
in Web.Public folder is the solution. Thank you.
Version: 6.8.0 ASP.NET Core & Angular
Download and build the project. Unmodified. Styles do not appear to be applied. Browser console message: "Refused to apply style from '<URL>' because its MIME type ('') is not a supported stylesheet MIME type, and strict MIME checking is enabled." No errors is log file. "Bundle & Minifier" and "Web Compiler" extensions are installed. cd to folder "*.Web.Public" and ran "npm run create-bundles" from command line. (Don't know how to "run Web Compiler" per #6527) Please advise.
OK, don't use the above code. Your answer isn't very hepful. I am using the RAD tool to emit code which implements (somewhere, Apb?) soft delete. ISoftDelete
does not exist in my app, ergo, I can't not do something that does not exist.
Please show by example how to "not implement ISoftDelete
" so that I can hard delete a record in a standard ANZ app.
I tried the above solution:
using (CurrentUnitOfWork.DisableFilter(AbpDataFilters.SoftDelete))
{
await _roomRepository.DeleteAsync(input.Id); /* input.Id = 6 */
}
Yet the records are still soft deleted. How can I actually remove records from a table so that, for example, record id = 6 does not exist in the table?
Hard delete is a non-negotiable requirement for my application. Absent hard delete the database size would explode in a short time, and consist of 95% soft deleted records.
https://support.aspnetzero.com/QA/Questions?Sort=LastActivityDate-desc&CreatorUserId=2b107550-3b53-4613-bcab-6f4ef87d8eac
Is there any way I can disable the Websockets DEBUG messages from appearing in the debug console window?
Starting connection using WebSockets transport
Connected to SignalR server!
Information: WebSocket connected to ws://localhost:22742/signalr?
enc_auth_token ...
If I need the info I will re-enable them.
Selecting newest, oldest, etc. sort order has no effect on the display order.