check in all the work is good to go now.
This commit is contained in:
@@ -39,7 +39,6 @@ namespace CarParkValidationAPI.Controllers
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> ConcessionValidation(bool onlyActive=true)
|
||||
{
|
||||
|
||||
var retval = await _concessionValidation.LoadConcessionValidationAsync(onlyActive);
|
||||
return Ok(retval);
|
||||
}
|
||||
@@ -51,6 +50,13 @@ namespace CarParkValidationAPI.Controllers
|
||||
return Ok(retval);
|
||||
}
|
||||
|
||||
[HttpGet("[action]")]
|
||||
public async Task<IActionResult> CheckConcessionValidationByStaff(string staffLinkNo, string concessionCard, DateTime currentDate)
|
||||
{
|
||||
var retval = await _concessionValidation.CheckConcessionValidationStaffLinkNoAsync(staffLinkNo, concessionCard, currentDate);
|
||||
return Ok(retval);
|
||||
}
|
||||
|
||||
[HttpGet("{id:int}")]
|
||||
public async Task<IActionResult> ConcessionValidation(int id)
|
||||
{
|
||||
|
||||
@@ -81,10 +81,22 @@ namespace CarParkValidationAPI.Datas
|
||||
myobj = reader["ConcessionType"];
|
||||
if (myobj != System.DBNull.Value)
|
||||
item.ConcessionType = (string)myobj;
|
||||
|
||||
myobj = reader["ValidationPoint"];
|
||||
if (myobj != System.DBNull.Value)
|
||||
item.ValidationPiont = (string)myobj;
|
||||
item.ValidationPoint = (string)myobj;
|
||||
|
||||
myobj = reader["StaffFirstName"];
|
||||
if (myobj != System.DBNull.Value)
|
||||
item.StaffFirstName = (string)myobj;
|
||||
|
||||
myobj = reader["StaffLastName"];
|
||||
if (myobj != System.DBNull.Value)
|
||||
item.StaffLastName = (string)myobj;
|
||||
|
||||
myobj = reader["StaffEmail"];
|
||||
if (myobj != System.DBNull.Value)
|
||||
item.StaffEmail = (string)myobj;
|
||||
|
||||
/*
|
||||
myobj = reader["ValidationPointID"];
|
||||
if (myobj != System.DBNull.Value)
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace CarParkValidationAPI.Entities
|
||||
public class ConcessionValidationExtDto: ConcessionValidationDto
|
||||
{
|
||||
public string ConcessionType { get; set; }
|
||||
public string ValidationPiont { get; set; }
|
||||
public string ValidationPoint { get; set; }
|
||||
|
||||
|
||||
}
|
||||
@@ -32,6 +32,10 @@ namespace CarParkValidationAPI.Entities
|
||||
public int ValidationPointId { get; set; }
|
||||
|
||||
public bool Active { get; set; }
|
||||
|
||||
public string StaffFirstName { get; set; }
|
||||
public string StaffLastName { get; set; }
|
||||
public string StaffEmail { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace CarParkValidationAPI.Interface
|
||||
{
|
||||
Task<ResultModel<List<ConcessionValidationExtDto>>> LoadConcessionValidationAsync(bool OnlyActive);
|
||||
Task<ResultModel<List<ConcessionValidationExtDto>>> LoadConcessionValidationStaffLinkNoAsync(string staffLinkNo, DateTime currentDate);
|
||||
Task<ResultModel<int>> CheckConcessionValidationStaffLinkNoAsync(string staffLinkNo, string concessionCard, DateTime currentDate);
|
||||
Task<ResultModel<int>> SaveConcessionValidationAsync(ConcessionValidationDto item);
|
||||
Task<ResultModel<ConcessionValidationDto>> LoadConcessionValidationByIdAsync(int id);
|
||||
Task<ResultModel<bool>> DeleteConcessionValidationAsync(int id);
|
||||
|
||||
Binary file not shown.
@@ -42,6 +42,9 @@ namespace CarParkValidationAPI.Models
|
||||
public int ValidationPointID { get; set; }
|
||||
|
||||
public bool Active { get; set; }
|
||||
public string StaffFirstName { get; set; }
|
||||
public string StaffLastName { get; set; }
|
||||
public string StaffEmail { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,13 +10,14 @@ namespace CarParkValidationAPI.Models.Users
|
||||
public string Username { get; set; }
|
||||
public AdminRole Role { get; set; }
|
||||
public string Token { get; set; }
|
||||
|
||||
public string Email { get; set; }
|
||||
public AuthenticateResponse(User user, string token)
|
||||
{
|
||||
Id = user.Id;
|
||||
FirstName = user.FirstName;
|
||||
LastName = user.LastName;
|
||||
Username = user.Username;
|
||||
Email = user.Email;
|
||||
Role = user.Role;
|
||||
Token = token;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"launchUrl": "api/v1/LookupCode/ConcessionTypes",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
|
||||
@@ -33,37 +33,75 @@ namespace CarParkValidationAPI.Repository
|
||||
SLDocument sl = new SLDocument();
|
||||
|
||||
|
||||
//first sheetName
|
||||
sl.RenameWorksheet(SLDocument.DefaultFirstSheetName, "ConcessionValidation");
|
||||
SLStyle style = sl.CreateStyle();
|
||||
style.SetFontUnderline(DocumentFormat.OpenXml.Spreadsheet.UnderlineValues.Single);
|
||||
style.SetFontBold(true);
|
||||
style.SetFont("Arial Black", 16);
|
||||
sl.SetCellStyle(1, 5, style);
|
||||
sl.SetRowHeight(1, 1, 25);
|
||||
sl.SetCellValue(row++, 5, "The ConssionValidation Report");
|
||||
|
||||
sl.SetCellValue(1, 8, " " + DateTime.Now.ToString("ddd dd/MM/yyyy HH:mm"));
|
||||
|
||||
int startTitleRow = 3;
|
||||
row = startTitleRow;
|
||||
//make the title bold
|
||||
style = sl.CreateStyle();
|
||||
style.Font.Bold = true;
|
||||
sl.SetRowStyle(startTitleRow, style);
|
||||
//set it height
|
||||
sl.SetRowHeight(startTitleRow, startTitleRow, 25);
|
||||
// add the title first
|
||||
sl.SetCellValue(row, col++, "Date");
|
||||
sl.SetCellValue(row, col++, "Concession Card");
|
||||
sl.SetCellValue(row, col++, "Concession Holder");
|
||||
sl.SetCellValue(row, col++, "ConcessionExpiry");
|
||||
sl.SetCellValue(row, col++, "Is Concession Expiry");
|
||||
sl.SetCellValue(row, col++, "ConcessionType");
|
||||
sl.SetCellValue(row, col++, "ValidationPiont");
|
||||
sl.SetCellValue(row, col++, "Validation Piont");
|
||||
sl.SetCellValue(row, col++, "StaffLink No");
|
||||
sl.SetCellValue(row, col++, "Staff first name");
|
||||
sl.SetCellValue(row, col++, "Staff last name");
|
||||
sl.SetCellValue(row, col++, "Staff Email");
|
||||
//wrap text on is concession Expiry
|
||||
style = sl.CreateStyle();
|
||||
style.SetWrapText(true);
|
||||
sl.SetColumnStyle(4, style);
|
||||
|
||||
//format date
|
||||
|
||||
SLStyle style = sl.CreateStyle();
|
||||
style.FormatCode = "dd/mm/yyyy hh:mm:ss";
|
||||
sl.SetColumnStyle(1, style);
|
||||
style = sl.CreateStyle();
|
||||
style.Font.Bold = true;
|
||||
sl.SetRowStyle(1, style);
|
||||
|
||||
style.FormatCode = "dd/mm/yyyy";
|
||||
sl.SetColumnStyle(1, style);
|
||||
//make column width
|
||||
sl.SetColumnWidth(1, 20);
|
||||
sl.SetColumnWidth(2, 18);
|
||||
sl.SetColumnWidth(3, 25);
|
||||
sl.SetColumnWidth(4, 20);
|
||||
sl.SetColumnWidth(5, 30);
|
||||
sl.SetColumnWidth(6, 40);
|
||||
sl.SetColumnWidth(7, 20);
|
||||
sl.SetColumnWidth(8, 20);
|
||||
sl.SetColumnWidth(9, 20);
|
||||
sl.SetColumnWidth(10, 20);
|
||||
int startRowFrom = startTitleRow+1;
|
||||
var list = await _context.SelectConcessionValidationByDate(true, fromDate.ToLocalTime(), toDate.ToLocalTime());
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
col = 1;
|
||||
item = list[i];
|
||||
row = i + 2;
|
||||
row = i + startRowFrom;
|
||||
sl.SetCellValue(row, col++, item.ValidateDate);
|
||||
sl.SetCellValue(row, col++, item.ConcessionCard);
|
||||
sl.SetCellValue(row, col++, item.ConcessionHolder);
|
||||
sl.SetCellValue(row, col++, item.ConcessionExpiry);
|
||||
sl.SetCellValue(row, col++, item.ConcessionExpiry ? "Yes": "No");
|
||||
sl.SetCellValue(row, col++, item.ConcessionType);
|
||||
sl.SetCellValue(row, col++, item.ValidationPiont);
|
||||
sl.SetCellValue(row, col++, item.ValidationPoint);
|
||||
sl.SetCellValue(row, col++, item.StafflinkNo);
|
||||
sl.SetCellValue(row, col++, item.StaffFirstName);
|
||||
sl.SetCellValue(row, col++, item.StaffLastName);
|
||||
sl.SetCellValue(row, col++, item.StaffEmail);
|
||||
}
|
||||
byte[] array;
|
||||
// sl.SaveAs("C:\\Temp\\Report\\ConcessionValidationDate" + DateTime.Now.ToString("yyyyMMddHHmm") + ".xlsx");
|
||||
@@ -82,7 +120,6 @@ namespace CarParkValidationAPI.Repository
|
||||
|
||||
}
|
||||
|
||||
|
||||
var result = new FileContent
|
||||
{
|
||||
Content = array,
|
||||
@@ -90,8 +127,6 @@ namespace CarParkValidationAPI.Repository
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
return new ResultModel<FileContent>
|
||||
{
|
||||
Data = result,
|
||||
|
||||
@@ -41,6 +41,9 @@ namespace CarParkValidationAPI.Repository
|
||||
dto.StafflinkNo = model.StafflinkNo;
|
||||
dto.ValidateDate = model.ValidateDate;
|
||||
dto.ValidationPointId = model.ValidationPointID;
|
||||
dto.StaffFirstName = model.StaffFirstName;
|
||||
dto.StaffLastName = model.StaffLastName;
|
||||
dto.StaffEmail = model.StaffEmail;
|
||||
return dto;
|
||||
}
|
||||
|
||||
@@ -53,7 +56,9 @@ namespace CarParkValidationAPI.Repository
|
||||
dto.ConcessionHolder = model.ConcessionHolder;
|
||||
dto.ConcessionTypeId = model.ConcessionTypeID;
|
||||
dto.Id = model.ValidationID;
|
||||
dto.StafflinkNo = model.StafflinkNo;
|
||||
dto.StaffFirstName = model.StaffFirstName;
|
||||
dto.StaffLastName = model.StaffLastName;
|
||||
dto.StaffEmail = model.StaffEmail;
|
||||
dto.ValidateDate = model.ValidateDate;
|
||||
dto.ValidationPointId = model.ValidationPointID;
|
||||
return dto;
|
||||
@@ -61,7 +66,6 @@ namespace CarParkValidationAPI.Repository
|
||||
|
||||
private ConcessionValidation FillConcessionValidation(ConcessionValidationDto dto, ConcessionValidation model)
|
||||
{
|
||||
|
||||
model.Active = dto.Active;
|
||||
model.ConcessionCard = dto.ConcessionCard;
|
||||
model.ConcessionExpiry = dto.ConcessionExpiry;
|
||||
@@ -69,6 +73,9 @@ namespace CarParkValidationAPI.Repository
|
||||
model.ConcessionTypeID = dto.ConcessionTypeId;
|
||||
model.ValidationID = dto.Id;
|
||||
model.StafflinkNo = dto.StafflinkNo;
|
||||
model.StaffFirstName = dto.StaffFirstName;
|
||||
model.StaffLastName = dto.StaffLastName;
|
||||
model.StaffEmail = dto.StaffEmail;
|
||||
model.ValidateDate = dto.ValidateDate.ToLocalTime();
|
||||
model.ValidationPointID = dto.ValidationPointId;
|
||||
return model;
|
||||
@@ -150,6 +157,46 @@ namespace CarParkValidationAPI.Repository
|
||||
Message = error
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<ResultModel<int>> CheckConcessionValidationStaffLinkNoAsync(string staffLinkNo, string concessionCard, DateTime currentDate)
|
||||
{
|
||||
int statuscode = 1;
|
||||
int result = 1;
|
||||
string message = "warning you already add concession card on this date!";
|
||||
try
|
||||
{
|
||||
var anyRecord = await _context.ConcessionValidations.Where(x =>
|
||||
x.StafflinkNo == staffLinkNo
|
||||
&& x.ConcessionCard == concessionCard
|
||||
&& x.Active == true
|
||||
&& x.ValidateDate.Date == currentDate.ToLocalTime().Date
|
||||
).ToListAsync();
|
||||
if (anyRecord.Count > 0)
|
||||
{
|
||||
result = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = 1; //test
|
||||
message = "test OK just one time";
|
||||
}
|
||||
statuscode = 1;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
message = "Error " + ex.ToString();
|
||||
statuscode = 0;
|
||||
result = 0;
|
||||
}
|
||||
|
||||
return new ResultModel<int>()
|
||||
{
|
||||
Data = result,
|
||||
StatusCode = statuscode,
|
||||
Message = message,
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<ResultModel<ConcessionValidationDto>> LoadConcessionValidationByIdAsync(int id)
|
||||
{
|
||||
ConcessionValidationDto result = null;
|
||||
@@ -229,7 +276,8 @@ namespace CarParkValidationAPI.Repository
|
||||
if (id > 0)
|
||||
{
|
||||
ConcessionValidation model = await _context.ConcessionValidations.FindAsync(id);
|
||||
model.Active = false;
|
||||
// model.Active = false;
|
||||
_context.ConcessionValidations.Remove(model);
|
||||
await _context.SaveChangesAsync();
|
||||
statuscode = 1;
|
||||
}
|
||||
|
||||
@@ -56,12 +56,14 @@ namespace CarParkValidationAPI.Repository
|
||||
user.LastName = "LS Test";
|
||||
user.Role = AdminRole.Admin;
|
||||
user.Username = model.Username;
|
||||
user.Email = "admin@mail.com";
|
||||
}
|
||||
else
|
||||
{
|
||||
user.Username = model.Username;
|
||||
user.FirstName = model.Username;
|
||||
user.FirstName = "FS Normal";
|
||||
user.LastName = " LS Normal";
|
||||
user.Email = "Normal@mail.com";
|
||||
user.Role = AdminRole.Normal;
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace CarParkValidationAPI.Repository
|
||||
&& x.Active == true);
|
||||
if (user != null)
|
||||
{
|
||||
myUser.Role = user.RoleType;
|
||||
myUser.Role = AdminRole.Admin; //user.RoleType;
|
||||
myUser.Id = user.UserID;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -84,7 +84,8 @@ namespace CarParkValidationAPI
|
||||
});
|
||||
*/
|
||||
services.AddScoped<IJwtUtils, JwtUtils>();
|
||||
services.AddScoped<IUserService, UserFakeRepository>();
|
||||
//services.AddScoped<IUserService, UserFakeRepository>();
|
||||
services.AddScoped<IUserService, UserRepository>();
|
||||
services.AddScoped<IConcessionType, ConcessionTypeRepository>();
|
||||
services.AddScoped<IValidationPoint, ValidationPointRepository>();
|
||||
services.AddScoped<IAdminUser, AdminUserRepository>();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"AppSettings": {
|
||||
"Secret": "Nepean Blue Mountain Super Secret SIGN AND VERIFY JWT TOKENS, BEARER TOKEN USE WHEN CALLING THIS API.",
|
||||
"SQLConnectionString": "Server=tcp:10.60.207.82,1433;Initial Catalog=CarParkValidation;Persist Security Info=False;User ID=bids_admin;Password=Password4BI;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=True;Connection Timeout=30;",
|
||||
"LDAPPath": "LDAP://ldap.nswhealth.net:389/OU=Accounts,DC=nswhealth,DC=net",
|
||||
"LDAPUser": "SRV-NBMS-BIDSPMS",
|
||||
"LDAPPassword": "42Ytp2AE3nN16eBoyia86UZH6",
|
||||
|
||||
Reference in New Issue
Block a user