upate reqyest
This commit is contained in:
parent
17bd6a7727
commit
83f92ea6c8
|
|
@ -719,6 +719,13 @@ namespace OnlineSalesAutoCrop.CoreAPI.Models
|
||||||
ZDS2 = 3
|
ZDS2 = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum UserTypeEnum : short
|
||||||
|
{
|
||||||
|
SuperAdmin = 1,
|
||||||
|
Admin = 2,
|
||||||
|
SalesAppOfficer = 3
|
||||||
|
}
|
||||||
|
|
||||||
public enum MaterialPriceTypeEnum : short
|
public enum MaterialPriceTypeEnum : short
|
||||||
{
|
{
|
||||||
BasePrice = 1,
|
BasePrice = 1,
|
||||||
|
|
|
||||||
|
|
@ -64,9 +64,8 @@ public class IntegrationCustomerRequest
|
||||||
[EmailAddress(ErrorMessage = "Email address is not valid.")]
|
[EmailAddress(ErrorMessage = "Email address is not valid.")]
|
||||||
public string? EmailAddress { get; set; }
|
public string? EmailAddress { get; set; }
|
||||||
|
|
||||||
[Required(ErrorMessage = "Business/Tax number is required.")]
|
|
||||||
[StringLength(16, ErrorMessage = "Business/Tax number cannot exceed 16 characters.")]
|
[StringLength(16, ErrorMessage = "Business/Tax number cannot exceed 16 characters.")]
|
||||||
public string BusinessTaxNumber { get; set; }
|
public string? BusinessTaxNumber { get; set; }
|
||||||
|
|
||||||
[Required(ErrorMessage = "Credit limit is required.")]
|
[Required(ErrorMessage = "Credit limit is required.")]
|
||||||
[Range(0, 9999999999999.99, ErrorMessage = "Credit limit must be between 0 and 9,999,999,999,999.99.")]
|
[Range(0, 9999999999999.99, ErrorMessage = "Credit limit must be between 0 and 9,999,999,999,999.99.")]
|
||||||
|
|
|
||||||
|
|
@ -534,16 +534,16 @@ public class IntegrationService : IIntegrationService
|
||||||
DivisionDescription = dr.GetString(12),
|
DivisionDescription = dr.GetString(12),
|
||||||
MobileNumber = dr.GetString(13),
|
MobileNumber = dr.GetString(13),
|
||||||
EmailAddress = dr.GetString(14),
|
EmailAddress = dr.GetString(14),
|
||||||
BusinessTaxNumber = dr.GetString(15),
|
BusinessTaxNumber =dr.IsDBNull(15)? null: dr.GetString(15),
|
||||||
CreditLimit = dr.GetDecimal(16),
|
CreditLimit = dr.GetDecimal(16),
|
||||||
SalesGroup = dr.GetString(17),
|
SalesGroup = dr.IsDBNull(17) ? null: dr.GetString(17),
|
||||||
SalesGroupDescription = dr.GetString(18),
|
SalesGroupDescription = dr.IsDBNull(18) ? null : dr.GetString(18),
|
||||||
CustomerGroup = dr.GetString(19),
|
CustomerGroup = dr.IsDBNull(19) ? null : dr.GetString(19),
|
||||||
CustomerGroupDescription = dr.GetString(20),
|
CustomerGroupDescription = dr.IsDBNull(20) ? null : dr.GetString(20),
|
||||||
CustomerPriceGroup = dr.GetString(21),
|
CustomerPriceGroup = dr.IsDBNull(21) ? null : dr.GetString(21),
|
||||||
CustomerPriceGroupDescription = dr.GetString(22),
|
CustomerPriceGroupDescription = dr.IsDBNull(22) ? null : dr.GetString(22),
|
||||||
StatusCode = dr.GetString(23),
|
StatusCode = dr.IsDBNull(23) ? null : dr.GetString(23),
|
||||||
StatusDescription = dr.GetString(24),
|
StatusDescription = dr.IsDBNull(24) ? null : dr.GetString(24),
|
||||||
PaymentTerms = dr.GetString(25),
|
PaymentTerms = dr.GetString(25),
|
||||||
PaymentTermsDescription = dr.GetString(26),
|
PaymentTermsDescription = dr.GetString(26),
|
||||||
SearchTerm = dr.GetString(27),
|
SearchTerm = dr.GetString(27),
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Ease.NetCore.DataAccess;
|
using DocumentFormat.OpenXml.Office2016.Excel;
|
||||||
|
using Ease.NetCore.DataAccess;
|
||||||
using Ease.NetCore.DataAccess.SQL;
|
using Ease.NetCore.DataAccess.SQL;
|
||||||
using Microsoft.Data.SqlClient;
|
using Microsoft.Data.SqlClient;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
|
@ -10,6 +11,7 @@ using OnlineSalesAutoCrop.CoreAPI.Models.Responses.MobileApp;
|
||||||
using OnlineSalesAutoCrop.CoreAPI.Services.Contracts.Integrations;
|
using OnlineSalesAutoCrop.CoreAPI.Services.Contracts.Integrations;
|
||||||
using OnlineSalesAutoCrop.CoreAPI.Services.Contracts.MobileApp;
|
using OnlineSalesAutoCrop.CoreAPI.Services.Contracts.MobileApp;
|
||||||
using OnlineSalesAutoCrop.CoreAPI.Services.Contracts.Systems;
|
using OnlineSalesAutoCrop.CoreAPI.Services.Contracts.Systems;
|
||||||
|
using Org.BouncyCastle.Asn1.Ocsp;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
|
@ -374,10 +376,14 @@ public class MobileMasterDataService : IMobileMasterDataService
|
||||||
decimal totalApprovedAmount = 0;
|
decimal totalApprovedAmount = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
SqlParameter[] p =
|
||||||
using (IDataReader dr = await tc.ExecuteReaderSpAsync("dbo.GetCustomerApprovedAmount"))
|
[
|
||||||
|
SqlHelperExtension.CreateInParam(pName: "@CustomerCode", pType: SqlDbType.NVarChar, pValue: customerCode),
|
||||||
|
SqlHelperExtension.CreateInParam(pName: "@SalesOrgCode", pType: SqlDbType.NVarChar, pValue: salesOrgCode),
|
||||||
|
];
|
||||||
|
using (IDataReader dr = await tc.ExecuteReaderSpAsync("dbo.GetCustomerApprovedAmount",p))
|
||||||
{
|
{
|
||||||
while (dr.Read())
|
if (dr.Read())
|
||||||
{
|
{
|
||||||
totalApprovedAmount = dr.GetDecimal(0);
|
totalApprovedAmount = dr.GetDecimal(0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,314 +39,290 @@ namespace OnlineSalesAutoCrop.CoreAPI.Services.Services.Systems
|
||||||
public async Task<User> LoginAsync(LoginRequest request, string ipAddress, bool checkPwd)
|
public async Task<User> LoginAsync(LoginRequest request, string ipAddress, bool checkPwd)
|
||||||
{
|
{
|
||||||
User user = new() { LoginId = request.LoginId, LoginStatus = EnumLoginStatus.Unsuccessful };
|
User user = new() { LoginId = request.LoginId, LoginStatus = EnumLoginStatus.Unsuccessful };
|
||||||
//try
|
try
|
||||||
//{
|
{
|
||||||
// string password = EncryptPassword(password: request.Password);
|
string password = EncryptPassword(password: request.Password);
|
||||||
|
|
||||||
// using TransactionContext tc = await TransactionContext.BeginAsync(_settings.DefaultConnection.ConnectionNode, true);
|
using TransactionContext tc = await TransactionContext.BeginAsync(_settings.DefaultConnection.ConnectionNode, true);
|
||||||
// try
|
try
|
||||||
// {
|
{
|
||||||
// #region Attendance Login and Valid Ip Address
|
|
||||||
|
|
||||||
// if (request.AttendanceLogin && !request.LoginId.ToLower().Equals(User.SuperUser_LoginId))
|
bool batchEnabled = false;
|
||||||
// {
|
DateTime sysDate = DateTime.Today.Date;
|
||||||
// string errMsg = string.Empty;
|
string appVer = string.Empty, alParams = string.Empty;
|
||||||
// SqlParameter[] p =
|
int maxTryCount = 5, lockTime = 1, marMonths = 24, idleTime = 0, timeoutTime = 0, pingTime = 0, bmProcessId = 0, prProcessId = 0;
|
||||||
// [
|
|
||||||
// SqlHelperExtension.CreateInParam(pName: "@IpAddress", pType: SqlDbType.VarChar, pValue: request.IpAddress, size: 20),
|
|
||||||
// SqlHelperExtension.CreateInParam(pName: "@MacAddress", pType: SqlDbType.VarChar, pValue: request.MacAddress, size: 30),
|
|
||||||
// SqlHelperExtension.CreateInParam(pName: "@HostName", pType: SqlDbType.VarChar, pValue: request.HostName, size: 100),
|
|
||||||
// SqlHelperExtension.CreateInParam(pName: "@LoginId", pType: SqlDbType.VarChar, pValue: request.LoginId, size: 50),
|
|
||||||
// SqlHelperExtension.CreateOutParam(pName: "@ErrMsg", pType: SqlDbType.VarChar, pValue: errMsg, size: 300)
|
|
||||||
// ];
|
|
||||||
// _ = tc.ExecuteNonQuerySp(spName: "dbo.IsValidIpOrMacAddress", parameterValues: p);
|
|
||||||
|
|
||||||
// errMsg = (p[4] == null || p[4].Value == null || p[4].Value == DBNull.Value) ? string.Empty : Convert.ToString(p[4].Value);
|
#region Read Params from ThisSystem
|
||||||
// if (!string.IsNullOrEmpty(errMsg))
|
|
||||||
// {
|
|
||||||
// tc.End();
|
|
||||||
// throw new InvalidOperationException(errMsg);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// #endregion
|
using (IDataReader dr = tc.ExecuteReader("SELECT MaxTryCount, LockTime, MarMonths, CAST(GETDATE() as date), AppVersion, AutoLogoutParams, BatchEnabled, BmProcessId, PrProcessId FROM ThisSystem"))
|
||||||
|
{
|
||||||
|
if (dr.Read())
|
||||||
|
{
|
||||||
|
maxTryCount = dr.GetInt16(0);
|
||||||
|
lockTime = dr.GetInt16(1);
|
||||||
|
marMonths = dr.GetInt16(2);
|
||||||
|
sysDate = dr.GetDateTime(3);
|
||||||
|
appVer = dr.GetString(4);
|
||||||
|
alParams = dr.IsDBNull(5) ? string.Empty : dr.GetString(5);
|
||||||
|
batchEnabled = !dr.IsDBNull(6) && dr.GetInt16(6) != 0;
|
||||||
|
bmProcessId = dr.IsDBNull(7) ? 0 : dr.GetInt16(7);
|
||||||
|
prProcessId = dr.IsDBNull(8) ? 0 : dr.GetInt16(8);
|
||||||
|
}
|
||||||
|
dr.Close();
|
||||||
|
}
|
||||||
|
|
||||||
// bool batchEnabled = false;
|
if (!string.IsNullOrEmpty(alParams))
|
||||||
// DateTime sysDate = DateTime.Today.Date;
|
{
|
||||||
// string appVer = string.Empty, alParams = string.Empty;
|
string[] times = alParams.Split(separator: ',', options: StringSplitOptions.RemoveEmptyEntries);
|
||||||
// int maxTryCount = 5, lockTime = 1, marMonths = 24, idleTime = 0, timeoutTime = 0, pingTime = 0, bmProcessId = 0, prProcessId = 0;
|
if (times.Length == 3)
|
||||||
|
{
|
||||||
|
if (!int.TryParse(times[0], out idleTime))
|
||||||
|
idleTime = 0;
|
||||||
|
|
||||||
// #region Read Params from ThisSystem
|
if (!int.TryParse(times[1], out timeoutTime))
|
||||||
|
timeoutTime = 0;
|
||||||
|
|
||||||
// using (IDataReader dr = tc.ExecuteReader("SELECT MaxTryCount, LockTime, MarMonths, CAST(GETDATE() as date), AppVersion, AutoLogoutParams, BatchEnabled, BmProcessId, PrProcessId FROM ThisSystem"))
|
if (!int.TryParse(times[2], out pingTime))
|
||||||
// {
|
pingTime = 0;
|
||||||
// if (dr.Read())
|
}
|
||||||
// {
|
}
|
||||||
// maxTryCount = dr.GetInt16(0);
|
|
||||||
// lockTime = dr.GetInt16(1);
|
|
||||||
// marMonths = dr.GetInt16(2);
|
|
||||||
// sysDate = dr.GetDateTime(3);
|
|
||||||
// appVer = dr.GetString(4);
|
|
||||||
// alParams = dr.IsDBNull(5) ? string.Empty : dr.GetString(5);
|
|
||||||
// batchEnabled = !dr.IsDBNull(6) && dr.GetInt16(6) != 0;
|
|
||||||
// bmProcessId = dr.IsDBNull(7) ? 0 : dr.GetInt16(7);
|
|
||||||
// prProcessId = dr.IsDBNull(8) ? 0 : dr.GetInt16(8);
|
|
||||||
// }
|
|
||||||
// dr.Close();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (!string.IsNullOrEmpty(alParams))
|
if (!request.LoginId.ToLower().Equals(User.SuperUser_LoginId) && !request.AppVersion.Equals(appVer))
|
||||||
// {
|
{
|
||||||
// string[] times = alParams.Split(separator: ',', options: StringSplitOptions.RemoveEmptyEntries);
|
user.UnsuccessfulMsg = appVer;
|
||||||
// if (times.Length == 3)
|
user.LoginStatus = EnumLoginStatus.VersionMismatch;
|
||||||
// {
|
}
|
||||||
// if (!int.TryParse(times[0], out idleTime))
|
|
||||||
// idleTime = 0;
|
|
||||||
|
|
||||||
// if (!int.TryParse(times[1], out timeoutTime))
|
#endregion
|
||||||
// timeoutTime = 0;
|
|
||||||
|
|
||||||
// if (!int.TryParse(times[2], out pingTime))
|
//if (user.LoginStatus != EnumLoginStatus.VersionMismatch)
|
||||||
// pingTime = 0;
|
//{
|
||||||
// }
|
// #region Read User data using authentication data
|
||||||
// }
|
|
||||||
|
|
||||||
// if (!request.LoginId.ToLower().Equals(User.SuperUser_LoginId) && !request.AppVersion.Equals(appVer))
|
// string commandText;
|
||||||
// {
|
// if (!checkPwd)
|
||||||
// user.UnsuccessfulMsg = appVer;
|
// {
|
||||||
// user.LoginStatus = EnumLoginStatus.VersionMismatch;
|
// commandText = SQLParser.MakeSQL("SELECT UserId, UserName, Status, MobileNo, EmailAddress, AuthReqAtlogin, AuthMethod,"
|
||||||
// }
|
// + " AuthKey, AppId, AccessStatus, NeverExpire, LastPasswords, LastPassChgDate, ExpireDate, ThemeName, SchemeName, MenuLayout,"
|
||||||
|
// + " IsLocked, NextLoginTime, DBOnStartup, DAMultiLogin, ViewOwnTaskOnly, EmployeeId, LoginID, EmployeeCode FROM Users WHERE LoginID=%s", request.LoginId);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// commandText = SQLParser.MakeSQL("SELECT UserId, UserName, Status, MobileNo, EmailAddress, AuthReqAtlogin, AuthMethod,"
|
||||||
|
// + " AuthKey, AppId, AccessStatus, NeverExpire, LastPasswords, LastPassChgDate, ExpireDate, ThemeName, SchemeName, MenuLayout,"
|
||||||
|
// + " IsLocked, NextLoginTime, DBOnStartup, DAMultiLogin, ViewOwnTaskOnly, EmployeeId, LoginID, EmployeeCode FROM Users"
|
||||||
|
// + " WHERE (LoginID=%s OR MobileNo=%s OR EmailAddress=%s) AND Password=%s", request.LoginId, request.LoginId, request.LoginId, password);
|
||||||
|
// }
|
||||||
|
|
||||||
// #endregion
|
// using (IDataReader dr = tc.ExecuteReader(commandText: commandText))
|
||||||
|
// {
|
||||||
|
// if (dr.Read())
|
||||||
|
// {
|
||||||
|
// user = new User
|
||||||
|
// {
|
||||||
|
// Id = dr.GetInt32(0),
|
||||||
|
// UserName = dr.GetString(1),
|
||||||
|
// Status = (EnumStatus)dr.GetInt16(2),
|
||||||
|
// MobileNo = dr.GetString(3),
|
||||||
|
// EmailAddress = dr.GetString(4),
|
||||||
|
// AuthRequiredAtLogin = !dr.IsDBNull(5) && dr.GetInt16(5) > 0,
|
||||||
|
// AuthMethod = (EnumAuthenticationMethod)dr.GetInt16(6),
|
||||||
|
// AuthKey = dr.IsDBNull(7) ? string.Empty : dr.GetString(7),
|
||||||
|
// AppId = dr.IsDBNull(8) ? string.Empty : dr.GetString(8),
|
||||||
|
// AccessStatus = (EnumAccessStatus)dr.GetInt16(9),
|
||||||
|
// NeverExpires = !dr.IsDBNull(10) && dr.GetInt16(10) > 0,
|
||||||
|
// LastPasswords = dr.IsDBNull(11) ? string.Empty : dr.GetString(11),
|
||||||
|
// LastPassChgDate = dr.IsDBNull(12) ? null : dr.GetDateTime(12),
|
||||||
|
// ExpireDate = dr.IsDBNull(13) ? null : dr.GetDateTime(13),
|
||||||
|
// ThemeName = dr.IsDBNull(14) ? "yellow" : dr.GetString(14),
|
||||||
|
// SchemeName = dr.IsDBNull(15) ? "dark" : dr.GetString(15),
|
||||||
|
// MenuLayout = dr.IsDBNull(16) ? "static" : dr.GetString(16),
|
||||||
|
// IsLocked = !dr.IsDBNull(17) && dr.GetInt16(17) > 0,
|
||||||
|
// NextLoginTime = dr.IsDBNull(18) ? null : dr.GetDateTime(18),
|
||||||
|
// DbOnStartup = dr.GetInt16(19) != 0,
|
||||||
|
// DisallowMultiLogin = dr.GetInt16(20) != 0,
|
||||||
|
// ViewOwnTaskOnly = dr.GetInt16(21) != 0,
|
||||||
|
// EmployeeId = dr.IsDBNull(22) ? null : dr.GetInt32(22),
|
||||||
|
// LoginId = dr.GetString(23),
|
||||||
|
// EmployeeCode = dr.IsDBNull(24) ? string.Empty : dr.GetString(24),
|
||||||
|
|
||||||
// if (user.LoginStatus != EnumLoginStatus.VersionMismatch)
|
// TeamSpaceIds = [],
|
||||||
// {
|
// IdleTime = idleTime,
|
||||||
// #region Read User data using authentication data
|
// PingTime = pingTime,
|
||||||
|
// SystemDate = sysDate,
|
||||||
|
// TimeoutTime = timeoutTime,
|
||||||
|
// PrProcessId = prProcessId,
|
||||||
|
// BmProcessId = bmProcessId,
|
||||||
|
// BatchEnabled = batchEnabled,
|
||||||
|
// LoginStatus = EnumLoginStatus.Success
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
// dr.Close();
|
||||||
|
|
||||||
// string commandText;
|
// user.MinReportDate = marMonths <= 0 ? new DateTime(year: 2015, month: 1, day: 1, hour: 0, minute: 0, second: 0, kind: DateTimeKind.Local) : sysDate.AddMonths(-1 * marMonths);
|
||||||
// if (!checkPwd)
|
// }
|
||||||
// {
|
|
||||||
// commandText = SQLParser.MakeSQL("SELECT UserId, UserName, Status, MobileNo, EmailAddress, AuthReqAtlogin, AuthMethod,"
|
|
||||||
// + " AuthKey, AppId, AccessStatus, NeverExpire, LastPasswords, LastPassChgDate, ExpireDate, ThemeName, SchemeName, MenuLayout,"
|
|
||||||
// + " IsLocked, NextLoginTime, DBOnStartup, DAMultiLogin, ViewOwnTaskOnly, EmployeeId, LoginID, EmployeeCode FROM Users WHERE LoginID=%s", request.LoginId);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// commandText = SQLParser.MakeSQL("SELECT UserId, UserName, Status, MobileNo, EmailAddress, AuthReqAtlogin, AuthMethod,"
|
|
||||||
// + " AuthKey, AppId, AccessStatus, NeverExpire, LastPasswords, LastPassChgDate, ExpireDate, ThemeName, SchemeName, MenuLayout,"
|
|
||||||
// + " IsLocked, NextLoginTime, DBOnStartup, DAMultiLogin, ViewOwnTaskOnly, EmployeeId, LoginID, EmployeeCode FROM Users"
|
|
||||||
// + " WHERE (LoginID=%s OR MobileNo=%s OR EmailAddress=%s) AND Password=%s", request.LoginId, request.LoginId, request.LoginId, password);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// using (IDataReader dr = tc.ExecuteReader(commandText: commandText))
|
// #endregion
|
||||||
// {
|
|
||||||
// if (dr.Read())
|
|
||||||
// {
|
|
||||||
// user = new User
|
|
||||||
// {
|
|
||||||
// Id = dr.GetInt32(0),
|
|
||||||
// UserName = dr.GetString(1),
|
|
||||||
// Status = (EnumStatus)dr.GetInt16(2),
|
|
||||||
// MobileNo = dr.GetString(3),
|
|
||||||
// EmailAddress = dr.GetString(4),
|
|
||||||
// AuthRequiredAtLogin = !dr.IsDBNull(5) && dr.GetInt16(5) > 0,
|
|
||||||
// AuthMethod = (EnumAuthenticationMethod)dr.GetInt16(6),
|
|
||||||
// AuthKey = dr.IsDBNull(7) ? string.Empty : dr.GetString(7),
|
|
||||||
// AppId = dr.IsDBNull(8) ? string.Empty : dr.GetString(8),
|
|
||||||
// AccessStatus = (EnumAccessStatus)dr.GetInt16(9),
|
|
||||||
// NeverExpires = !dr.IsDBNull(10) && dr.GetInt16(10) > 0,
|
|
||||||
// LastPasswords = dr.IsDBNull(11) ? string.Empty : dr.GetString(11),
|
|
||||||
// LastPassChgDate = dr.IsDBNull(12) ? null : dr.GetDateTime(12),
|
|
||||||
// ExpireDate = dr.IsDBNull(13) ? null : dr.GetDateTime(13),
|
|
||||||
// ThemeName = dr.IsDBNull(14) ? "yellow" : dr.GetString(14),
|
|
||||||
// SchemeName = dr.IsDBNull(15) ? "dark" : dr.GetString(15),
|
|
||||||
// MenuLayout = dr.IsDBNull(16) ? "static" : dr.GetString(16),
|
|
||||||
// IsLocked = !dr.IsDBNull(17) && dr.GetInt16(17) > 0,
|
|
||||||
// NextLoginTime = dr.IsDBNull(18) ? null : dr.GetDateTime(18),
|
|
||||||
// DbOnStartup = dr.GetInt16(19) != 0,
|
|
||||||
// DisallowMultiLogin = dr.GetInt16(20) != 0,
|
|
||||||
// ViewOwnTaskOnly = dr.GetInt16(21) != 0,
|
|
||||||
// EmployeeId = dr.IsDBNull(22) ? null : dr.GetInt32(22),
|
|
||||||
// LoginId = dr.GetString(23),
|
|
||||||
// EmployeeCode = dr.IsDBNull(24) ? string.Empty : dr.GetString(24),
|
|
||||||
|
|
||||||
// TeamSpaceIds = [],
|
// #region If the user was locked, try set set unlock if Time expired
|
||||||
// IdleTime = idleTime,
|
|
||||||
// PingTime = pingTime,
|
|
||||||
// SystemDate = sysDate,
|
|
||||||
// TimeoutTime = timeoutTime,
|
|
||||||
// PrProcessId = prProcessId,
|
|
||||||
// BmProcessId = bmProcessId,
|
|
||||||
// BatchEnabled = batchEnabled,
|
|
||||||
// LoginStatus = EnumLoginStatus.Success
|
|
||||||
// };
|
|
||||||
// }
|
|
||||||
// dr.Close();
|
|
||||||
|
|
||||||
// user.MinReportDate = marMonths <= 0 ? new DateTime(year: 2015, month: 1, day: 1, hour: 0, minute: 0, second: 0, kind: DateTimeKind.Local) : sysDate.AddMonths(-1 * marMonths);
|
// if (!request.LoginId.ToLower().Equals(User.SuperUser_LoginId) && user.IsLocked)
|
||||||
// }
|
// {
|
||||||
|
// int isSuccessful = 0;
|
||||||
|
// SqlParameter[] p =
|
||||||
|
// [
|
||||||
|
// SqlHelperExtension.CreateInParam(pName: "@LoginId", pType: SqlDbType.VarChar, pValue: request.LoginId, size: 30),
|
||||||
|
// SqlHelperExtension.CreateInParam(pName: "@LockTime", pType: SqlDbType.Int, pValue: lockTime),
|
||||||
|
// SqlHelperExtension.CreateOutParam(pName: "@IsSuccessful", pType: SqlDbType.Int, pValue: isSuccessful),
|
||||||
|
// ];
|
||||||
|
// _ = tc.ExecuteNonQuerySp(spName: "dbo.DoUnlockUser", parameterValues: p);
|
||||||
|
// if (p[2] != null && p[2].Value != null && p[2].Value != DBNull.Value)
|
||||||
|
// isSuccessful = Convert.ToInt32(p[2].Value);
|
||||||
|
|
||||||
// #endregion
|
// if (isSuccessful == 1)
|
||||||
|
// user.IsLocked = false;
|
||||||
|
// }
|
||||||
|
|
||||||
// #region If the user was locked, try set set unlock if Time expired
|
// #endregion
|
||||||
|
|
||||||
// if (!request.LoginId.ToLower().Equals(User.SuperUser_LoginId) && user.IsLocked)
|
// #region Keep log for unauthrise access and Set user lock if exceeds max try
|
||||||
// {
|
|
||||||
// int isSuccessful = 0;
|
|
||||||
// SqlParameter[] p =
|
|
||||||
// [
|
|
||||||
// SqlHelperExtension.CreateInParam(pName: "@LoginId", pType: SqlDbType.VarChar, pValue: request.LoginId, size: 30),
|
|
||||||
// SqlHelperExtension.CreateInParam(pName: "@LockTime", pType: SqlDbType.Int, pValue: lockTime),
|
|
||||||
// SqlHelperExtension.CreateOutParam(pName: "@IsSuccessful", pType: SqlDbType.Int, pValue: isSuccessful),
|
|
||||||
// ];
|
|
||||||
// _ = tc.ExecuteNonQuerySp(spName: "dbo.DoUnlockUser", parameterValues: p);
|
|
||||||
// if (p[2] != null && p[2].Value != null && p[2].Value != DBNull.Value)
|
|
||||||
// isSuccessful = Convert.ToInt32(p[2].Value);
|
|
||||||
|
|
||||||
// if (isSuccessful == 1)
|
// if (!request.LoginId.ToLower().Equals(User.SuperUser_LoginId) && maxTryCount > 0 && user.LoginStatus == EnumLoginStatus.Unsuccessful)
|
||||||
// user.IsLocked = false;
|
// {
|
||||||
// }
|
// int remainsTry = 0;
|
||||||
|
// DateTime? nextLoginTime = null;
|
||||||
|
// string tryLoginInfo = $"{request.LoginId}~{password}~13";
|
||||||
|
// SqlParameter[] p =
|
||||||
|
// [
|
||||||
|
// SqlHelperExtension.CreateInParam(pName: "@LoginId", pType: SqlDbType.VarChar, pValue: request.LoginId, size: 30),
|
||||||
|
// SqlHelperExtension.CreateInParam(pName: "@TryLoginInfo", pType: SqlDbType.VarChar, pValue: tryLoginInfo, size: 100),
|
||||||
|
// SqlHelperExtension.CreateInParam(pName: "@IpAddress", pType: SqlDbType.VarChar, pValue: ipAddress, size: 20),
|
||||||
|
// SqlHelperExtension.CreateInParam(pName: "@MaxTryCount", pType: SqlDbType.SmallInt, pValue: maxTryCount),
|
||||||
|
// SqlHelperExtension.CreateInParam(pName: "@LockTime", pType: SqlDbType.Int, pValue: lockTime),
|
||||||
|
// SqlHelperExtension.CreateOutParam(pName: "@RemainingTry", pType: SqlDbType.SmallInt, pValue: remainsTry),
|
||||||
|
// SqlHelperExtension.CreateOutParam(pName: "@NextLoginTime", pType: SqlDbType.DateTime, pValue: nextLoginTime),
|
||||||
|
// ];
|
||||||
|
// _ = tc.ExecuteNonQuerySp(spName: "dbo.LogUnauthorizeAccess", parameterValues: p);
|
||||||
|
// if (p[5] != null && p[5].Value != null && p[5].Value != DBNull.Value)
|
||||||
|
// remainsTry = Convert.ToInt32(p[5].Value);
|
||||||
|
|
||||||
// #endregion
|
// if (p[6] != null && p[6].Value != null && p[6].Value != DBNull.Value)
|
||||||
|
// nextLoginTime = Convert.ToDateTime(p[6].Value);
|
||||||
|
|
||||||
// #region Keep log for unauthrise access and Set user lock if exceeds max try
|
// if (remainsTry <= 0)
|
||||||
|
// {
|
||||||
|
// user.IsLocked = true;
|
||||||
|
// if (lockTime <= 0)
|
||||||
|
// {
|
||||||
|
// user.NextLoginTime = nextLoginTime;
|
||||||
|
// user.UnsuccessfulMsg = "Please contact with Head office to Unlock";
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// user.NextLoginTime = nextLoginTime;
|
||||||
|
// user.UnsuccessfulMsg = $"You can Login after {user.NextLoginTime:dd-MMM-yyyy H:mm:ss}";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// user.UnsuccessfulMsg = $"{remainsTry} More attempt{(remainsTry > 1 ? "s" : "")} remaining";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
// if (!request.LoginId.ToLower().Equals(User.SuperUser_LoginId) && maxTryCount > 0 && user.LoginStatus == EnumLoginStatus.Unsuccessful)
|
// #endregion
|
||||||
// {
|
|
||||||
// int remainsTry = 0;
|
|
||||||
// DateTime? nextLoginTime = null;
|
|
||||||
// string tryLoginInfo = $"{request.LoginId}~{password}~13";
|
|
||||||
// SqlParameter[] p =
|
|
||||||
// [
|
|
||||||
// SqlHelperExtension.CreateInParam(pName: "@LoginId", pType: SqlDbType.VarChar, pValue: request.LoginId, size: 30),
|
|
||||||
// SqlHelperExtension.CreateInParam(pName: "@TryLoginInfo", pType: SqlDbType.VarChar, pValue: tryLoginInfo, size: 100),
|
|
||||||
// SqlHelperExtension.CreateInParam(pName: "@IpAddress", pType: SqlDbType.VarChar, pValue: ipAddress, size: 20),
|
|
||||||
// SqlHelperExtension.CreateInParam(pName: "@MaxTryCount", pType: SqlDbType.SmallInt, pValue: maxTryCount),
|
|
||||||
// SqlHelperExtension.CreateInParam(pName: "@LockTime", pType: SqlDbType.Int, pValue: lockTime),
|
|
||||||
// SqlHelperExtension.CreateOutParam(pName: "@RemainingTry", pType: SqlDbType.SmallInt, pValue: remainsTry),
|
|
||||||
// SqlHelperExtension.CreateOutParam(pName: "@NextLoginTime", pType: SqlDbType.DateTime, pValue: nextLoginTime),
|
|
||||||
// ];
|
|
||||||
// _ = tc.ExecuteNonQuerySp(spName: "dbo.LogUnauthorizeAccess", parameterValues: p);
|
|
||||||
// if (p[5] != null && p[5].Value != null && p[5].Value != DBNull.Value)
|
|
||||||
// remainsTry = Convert.ToInt32(p[5].Value);
|
|
||||||
|
|
||||||
// if (p[6] != null && p[6].Value != null && p[6].Value != DBNull.Value)
|
// #region Generate and Save Otp if Otp is enabled and send thru SMS/Email
|
||||||
// nextLoginTime = Convert.ToDateTime(p[6].Value);
|
|
||||||
|
|
||||||
// if (remainsTry <= 0)
|
// if (user.LoginStatus == EnumLoginStatus.Success && user.Status == EnumStatus.Authorized && (user.AuthMethod == EnumAuthenticationMethod.Email || user.AuthMethod == EnumAuthenticationMethod.MobileSMS))
|
||||||
// {
|
// {
|
||||||
// user.IsLocked = true;
|
// string secretKey = $"{user.Id}~{user.LoginId}";
|
||||||
// if (lockTime <= 0)
|
// secretKey = secretKey.EncodeAsBase32String(addPadding: false);
|
||||||
// {
|
// user.AuthValue = TOtpService.GetCurrentPIN(secretKey: secretKey);
|
||||||
// user.NextLoginTime = nextLoginTime;
|
// SetAuthValue(tc: tc, authValue: user.AuthValue, validMinutes: 5, userId: user.Id);
|
||||||
// user.UnsuccessfulMsg = "Please contact with Head office to Unlock";
|
// }
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// user.NextLoginTime = nextLoginTime;
|
|
||||||
// user.UnsuccessfulMsg = $"You can Login after {user.NextLoginTime:dd-MMM-yyyy H:mm:ss}";
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// user.UnsuccessfulMsg = $"{remainsTry} More attempt{(remainsTry > 1 ? "s" : "")} remaining";
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
// #region Generate and Save Otp if Otp is enabled and send thru SMS/Email
|
// #region If login successful and user is active read module id for this user
|
||||||
|
|
||||||
// if (user.LoginStatus == EnumLoginStatus.Success && user.Status == EnumStatus.Authorized && (user.AuthMethod == EnumAuthenticationMethod.Email || user.AuthMethod == EnumAuthenticationMethod.MobileSMS))
|
// if (user.LoginStatus == EnumLoginStatus.Success && user.Status == EnumStatus.Authorized && !user.IsLocked)
|
||||||
// {
|
// {
|
||||||
// string secretKey = $"{user.Id}~{user.LoginId}";
|
// int logId = 0;
|
||||||
// secretKey = secretKey.EncodeAsBase32String(addPadding: false);
|
// DateTime? logoutTime = null;
|
||||||
// user.AuthValue = TOtpService.GetCurrentPIN(secretKey: secretKey);
|
// SqlParameter[] p =
|
||||||
// SetAuthValue(tc: tc, authValue: user.AuthValue, validMinutes: 5, userId: user.Id);
|
// [
|
||||||
// }
|
// SqlHelperExtension.CreateInParam(pName: "@UserId", pType: SqlDbType.Int, pValue: user.Id),
|
||||||
|
// SqlHelperExtension.CreateInParam(pName: "@IpAddress", pType: SqlDbType.VarChar, pValue: ipAddress, size: 20),
|
||||||
|
// SqlHelperExtension.CreateInParam(pName: "@AppId", pType: SqlDbType.VarChar, pValue: request.AppId, size: 250),
|
||||||
|
// SqlHelperExtension.CreateInParam(pName: "@LoginId", pType: SqlDbType.VarChar, pValue: user.LoginId, size: 30),
|
||||||
|
// SqlHelperExtension.CreateInParam(pName: "@LockTime", pType: SqlDbType.Int, pValue: lockTime),
|
||||||
|
// SqlHelperExtension.CreateInParam(pName: "@AttendanceLogin", pType: SqlDbType.Int, pValue: request.AttendanceLogin? 1:0),
|
||||||
|
// SqlHelperExtension.CreateInParam(pName: "@LocalIp", pType: SqlDbType.VarChar, pValue: request.IpAddress, size: 20),
|
||||||
|
// SqlHelperExtension.CreateInParam(pName: "@MacAddress", pType: SqlDbType.VarChar, pValue: request.MacAddress, size: 30),
|
||||||
|
// SqlHelperExtension.CreateInParam(pName: "@HostName", pType: SqlDbType.VarChar, pValue: request.HostName, size: 100),
|
||||||
|
// SqlHelperExtension.CreateInParam(pName: "@LoginRemarks", pType: SqlDbType.VarChar, pValue: request.LoginRemarks, size: 50)
|
||||||
|
// ];
|
||||||
|
// using (IDataReader dr = tc.ExecuteReaderSp(spName: "dbo.GetPermissionKeys", parameterValues: p))
|
||||||
|
// {
|
||||||
|
// user.ModuleIds = [];
|
||||||
|
// while (dr.Read())
|
||||||
|
// {
|
||||||
|
// string moduleId = dr.GetString(0);
|
||||||
|
// user.ModuleIds.Add(moduleId);
|
||||||
|
|
||||||
// #endregion
|
// logId = dr.GetInt32(1);
|
||||||
|
|
||||||
// #region If login successful and user is active read module id for this user
|
// if (dr.GetInt16(2) != 0) //Alow add
|
||||||
|
// {
|
||||||
|
// user.ModuleIds.Add($"{moduleId}_1");
|
||||||
|
// }
|
||||||
|
// if (dr.GetInt16(3) != 0) //Alow edit
|
||||||
|
// {
|
||||||
|
// user.ModuleIds.Add($"{moduleId}_2");
|
||||||
|
// }
|
||||||
|
|
||||||
// if (user.LoginStatus == EnumLoginStatus.Success && user.Status == EnumStatus.Authorized && !user.IsLocked)
|
// if (dr.GetInt16(4) != 0) //Allow Delete
|
||||||
// {
|
// {
|
||||||
// int logId = 0;
|
// user.ModuleIds.Add($"{moduleId}_3");
|
||||||
// DateTime? logoutTime = null;
|
// }
|
||||||
// SqlParameter[] p =
|
|
||||||
// [
|
|
||||||
// SqlHelperExtension.CreateInParam(pName: "@UserId", pType: SqlDbType.Int, pValue: user.Id),
|
|
||||||
// SqlHelperExtension.CreateInParam(pName: "@IpAddress", pType: SqlDbType.VarChar, pValue: ipAddress, size: 20),
|
|
||||||
// SqlHelperExtension.CreateInParam(pName: "@AppId", pType: SqlDbType.VarChar, pValue: request.AppId, size: 250),
|
|
||||||
// SqlHelperExtension.CreateInParam(pName: "@LoginId", pType: SqlDbType.VarChar, pValue: user.LoginId, size: 30),
|
|
||||||
// SqlHelperExtension.CreateInParam(pName: "@LockTime", pType: SqlDbType.Int, pValue: lockTime),
|
|
||||||
// SqlHelperExtension.CreateInParam(pName: "@AttendanceLogin", pType: SqlDbType.Int, pValue: request.AttendanceLogin? 1:0),
|
|
||||||
// SqlHelperExtension.CreateInParam(pName: "@LocalIp", pType: SqlDbType.VarChar, pValue: request.IpAddress, size: 20),
|
|
||||||
// SqlHelperExtension.CreateInParam(pName: "@MacAddress", pType: SqlDbType.VarChar, pValue: request.MacAddress, size: 30),
|
|
||||||
// SqlHelperExtension.CreateInParam(pName: "@HostName", pType: SqlDbType.VarChar, pValue: request.HostName, size: 100),
|
|
||||||
// SqlHelperExtension.CreateInParam(pName: "@LoginRemarks", pType: SqlDbType.VarChar, pValue: request.LoginRemarks, size: 50)
|
|
||||||
// ];
|
|
||||||
// using (IDataReader dr = tc.ExecuteReaderSp(spName: "dbo.GetPermissionKeys", parameterValues: p))
|
|
||||||
// {
|
|
||||||
// user.ModuleIds = [];
|
|
||||||
// while (dr.Read())
|
|
||||||
// {
|
|
||||||
// string moduleId = dr.GetString(0);
|
|
||||||
// user.ModuleIds.Add(moduleId);
|
|
||||||
|
|
||||||
// logId = dr.GetInt32(1);
|
// logoutTime = dr.IsDBNull(5) ? null : dr.GetDateTime(5);
|
||||||
|
// }
|
||||||
|
// dr.Close();
|
||||||
|
// }
|
||||||
|
// user.LogId = logId;
|
||||||
|
// user.LogoutTime = logoutTime;
|
||||||
|
|
||||||
// if (dr.GetInt16(2) != 0) //Alow add
|
// //Read User TeamSpace Ids
|
||||||
// {
|
// using (IDataReader dr = tc.ExecuteReader("SELECT TeamSpaceId FROM TeamSpaceUsers WHERE UserId=%n", user.Id))
|
||||||
// user.ModuleIds.Add($"{moduleId}_1");
|
// {
|
||||||
// }
|
// while (dr.Read())
|
||||||
// if (dr.GetInt16(3) != 0) //Alow edit
|
// {
|
||||||
// {
|
// user.TeamSpaceIds.Add(dr.GetInt32(0));
|
||||||
// user.ModuleIds.Add($"{moduleId}_2");
|
// }
|
||||||
// }
|
// dr.Close();
|
||||||
|
// }
|
||||||
|
|
||||||
// if (dr.GetInt16(4) != 0) //Allow Delete
|
// //Pending Notification count
|
||||||
// {
|
// user.NotificationCount = GetPendingNotifCount(tc: tc, userId: user.Id);
|
||||||
// user.ModuleIds.Add($"{moduleId}_3");
|
// }
|
||||||
// }
|
|
||||||
|
|
||||||
// logoutTime = dr.IsDBNull(5) ? null : dr.GetDateTime(5);
|
// #endregion
|
||||||
// }
|
//}
|
||||||
// dr.Close();
|
|
||||||
// }
|
|
||||||
// user.LogId = logId;
|
|
||||||
// user.LogoutTime = logoutTime;
|
|
||||||
|
|
||||||
// //Read User TeamSpace Ids
|
tc.End();
|
||||||
// using (IDataReader dr = tc.ExecuteReader("SELECT TeamSpaceId FROM TeamSpaceUsers WHERE UserId=%n", user.Id))
|
}
|
||||||
// {
|
catch (Exception ie)
|
||||||
// while (dr.Read())
|
{
|
||||||
// {
|
tc?.HandleError();
|
||||||
// user.TeamSpaceIds.Add(dr.GetInt32(0));
|
|
||||||
// }
|
|
||||||
// dr.Close();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //Pending Notification count
|
throw DBCustomError.GenerateCustomError(ie);
|
||||||
// user.NotificationCount = GetPendingNotifCount(tc: tc, userId: user.Id);
|
}
|
||||||
// }
|
}
|
||||||
|
catch (Exception e)
|
||||||
// #endregion
|
{
|
||||||
// }
|
throw new InvalidOperationException(e.Message, e);
|
||||||
|
}
|
||||||
// tc.End();
|
|
||||||
// }
|
|
||||||
// catch (Exception ie)
|
|
||||||
// {
|
|
||||||
// tc?.HandleError();
|
|
||||||
|
|
||||||
// throw DBCustomError.GenerateCustomError(ie);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//catch (Exception e)
|
|
||||||
//{
|
|
||||||
// throw new InvalidOperationException(e.Message, e);
|
|
||||||
//}
|
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
using System;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace OnlineSalesAutoCrop.CoreAPI.Converter;
|
||||||
|
|
||||||
|
public class EmptyStringToNullConverter : JsonConverter<string>
|
||||||
|
{
|
||||||
|
public override string? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||||
|
{
|
||||||
|
if (reader.TokenType == JsonTokenType.Null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
var value = reader.GetString();
|
||||||
|
|
||||||
|
return string.IsNullOrWhiteSpace(value) ? null : value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Write(Utf8JsonWriter writer, string? value, JsonSerializerOptions options)
|
||||||
|
{
|
||||||
|
writer.WriteStringValue(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -55,11 +55,11 @@ namespace OnlineSalesAutoCrop.CoreAPI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IConfiguration Configuration { get; }
|
public IConfiguration Configuration { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the Startup class using the specified configuration settings.
|
/// Initializes a new instance of the Startup class using the specified configuration settings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="configuration">The configuration settings used to initialize the application. Cannot be null.</param>
|
/// <param name="configuration">The configuration settings used to initialize the application. Cannot be null.</param>
|
||||||
public Startup(IConfiguration configuration)
|
public Startup(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
Configuration = configuration;
|
Configuration = configuration;
|
||||||
_appSettings = Configuration.GetSection("AppSettings").Get<AppSettings>();
|
_appSettings = Configuration.GetSection("AppSettings").Get<AppSettings>();
|
||||||
|
|
@ -86,14 +86,21 @@ namespace OnlineSalesAutoCrop.CoreAPI
|
||||||
#region Controllers
|
#region Controllers
|
||||||
|
|
||||||
services.AddControllers(options =>
|
services.AddControllers(options =>
|
||||||
|
{
|
||||||
|
options.Filters.Add(new ProducesAttribute("application/json"));
|
||||||
|
}).AddJsonOptions(options =>
|
||||||
{
|
{
|
||||||
options.Filters.Add(new ProducesAttribute("application/json"));
|
options.JsonSerializerOptions.Converters.Add(
|
||||||
|
new CoreAPI.Converter.EmptyStringToNullConverter());
|
||||||
});
|
});
|
||||||
|
|
||||||
services.Configure<ApiBehaviorOptions>(options =>
|
services.Configure<ApiBehaviorOptions>(options =>
|
||||||
{
|
{
|
||||||
options.InvalidModelStateResponseFactory = context =>
|
options.InvalidModelStateResponseFactory = context =>
|
||||||
{
|
{
|
||||||
|
var logger = context.HttpContext.RequestServices
|
||||||
|
.GetRequiredService<ILogger<Startup>>();
|
||||||
|
|
||||||
var errors = context.ModelState
|
var errors = context.ModelState
|
||||||
.Where(kvp => kvp.Value?.Errors.Count > 0)
|
.Where(kvp => kvp.Value?.Errors.Count > 0)
|
||||||
.SelectMany(kvp => kvp.Value!.Errors.Select(e => e.ErrorMessage))
|
.SelectMany(kvp => kvp.Value!.Errors.Select(e => e.ErrorMessage))
|
||||||
|
|
@ -106,6 +113,8 @@ namespace OnlineSalesAutoCrop.CoreAPI
|
||||||
Data = null
|
Data = null
|
||||||
};
|
};
|
||||||
|
|
||||||
|
logger.LogError("Validation Failed. Request: {@Errors}", errors);
|
||||||
|
|
||||||
return new BadRequestObjectResult(response);
|
return new BadRequestObjectResult(response);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ export class AppMenuComponent implements OnInit, AfterViewInit
|
||||||
|
|
||||||
ngOnInit()
|
ngOnInit()
|
||||||
{
|
{
|
||||||
|
debugger;
|
||||||
this.service.authService.sessionEvent.subscribe(value => this.onAuthenication(value));
|
this.service.authService.sessionEvent.subscribe(value => this.onAuthenication(value));
|
||||||
if (this.service.authService.currentUserValue)
|
if (this.service.authService.currentUserValue)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<form [formGroup]="loginForm" (ngSubmit)="onSubmit()" style="background-image:linear-gradient(360deg, #17c3f0,#1D81b1);">
|
<form [formGroup]="loginForm" (ngSubmit)="onSubmit()" style="background-image:linear-gradient(360deg, #17c3f0,#1D81b1);">
|
||||||
<div class="mb-2 login-body">
|
<div class="mb-2 login-body">
|
||||||
<div class="login-content">
|
<div class="login-content">
|
||||||
<h1 style="color:green;">Ease Taskforce</h1>
|
<h1 style="color:green;">Auto Crop</h1>
|
||||||
<p style="color: black;">Please use the form to Sign-in.</p>
|
<p style="color: black;">Please use the form to Sign-in.</p>
|
||||||
|
|
||||||
<div class="mb-3 col-lg-4 col-md-8 col-sm-12">
|
<div class="mb-3 col-lg-4 col-md-8 col-sm-12">
|
||||||
|
|
@ -41,38 +41,7 @@
|
||||||
<input type="checkbox" id="remberMe" name="remberMe" formControlName="remberMe" class="form-check-input" />
|
<input type="checkbox" id="remberMe" name="remberMe" formControlName="remberMe" class="form-check-input" />
|
||||||
<label class="form-check-label" for="remberMe" style="font-weight:500;color:black;">Remember me</label>
|
<label class="form-check-label" for="remberMe" style="font-weight:500;color:black;">Remember me</label>
|
||||||
</div>
|
</div>
|
||||||
@if (attendanceEnabled)
|
|
||||||
{
|
|
||||||
<div class="mb-1 form-check form-switch">
|
|
||||||
<input type="checkbox" id="atndnceLogin" name="atndnceLogin" formControlName="atndnceLogin" class="form-check-input" (change)="eventCheck($event)" />
|
|
||||||
<label class="form-check-label" for="atndnceLogin" style="font-weight:500;color:maroon;">Login into Attendance System</label>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
@if (remarksRequired && f.atndnceLogin.value)
|
|
||||||
{
|
|
||||||
<div class="mb-2 col-lg-4 col-md-8 col-sm-12">
|
|
||||||
<span class="required" style="color: black;">Late Login Remarks:</span>
|
|
||||||
<br />
|
|
||||||
<kendo-combobox [data]="lateLoginRemarks"
|
|
||||||
id="loginRemarks"
|
|
||||||
name="loginRemarks"
|
|
||||||
formControlName="loginRemarks"
|
|
||||||
[textField]="'itemValue'"
|
|
||||||
[valueField]="'itemValue'"
|
|
||||||
[valuePrimitive]="true"
|
|
||||||
[placeholder]="'Late Login Remarks...'"
|
|
||||||
[kendoDropDownFilter]="filterSettings"
|
|
||||||
[ngClass]="{ 'k-invalid': submitted && f.loginRemarks.errors}">
|
|
||||||
</kendo-combobox>
|
|
||||||
@if (submitted && f.loginRemarks.errors)
|
|
||||||
{
|
|
||||||
<div class="invalid-feedback">
|
|
||||||
Late Login Remarks is required
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
<div class="mt-3 mb-4">
|
<div class="mt-3 mb-4">
|
||||||
<button style="min-width:6.2em;" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-raised ui-button-text-only">
|
<button style="min-width:6.2em;" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-raised ui-button-text-only">
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ import { AppConfig, ComputerConfig } from '../components/models/app.config.model
|
||||||
})
|
})
|
||||||
export class LoginComponent implements OnInit
|
export class LoginComponent implements OnInit
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly router = inject(Router);
|
private readonly router = inject(Router);
|
||||||
private readonly route = inject(ActivatedRoute);
|
private readonly route = inject(ActivatedRoute);
|
||||||
private readonly modalService = inject(NgbModal);
|
private readonly modalService = inject(NgbModal);
|
||||||
|
|
@ -58,11 +59,12 @@ export class LoginComponent implements OnInit
|
||||||
|
|
||||||
constructor()
|
constructor()
|
||||||
{
|
{
|
||||||
|
debugger;
|
||||||
this.alertService.clear();
|
this.alertService.clear();
|
||||||
const configSvc = inject(ConfigurationService);
|
const configSvc = inject(ConfigurationService);
|
||||||
this.appConfig = configSvc.configuration?.appConfig;
|
this.appConfig = configSvc.configuration?.appConfig;
|
||||||
this.compConfig = configSvc.configuration?.computerConfig;
|
this.compConfig = configSvc.configuration?.computerConfig;
|
||||||
|
debugger;
|
||||||
if (this.authService.currentUserValue?.id)
|
if (this.authService.currentUserValue?.id)
|
||||||
{
|
{
|
||||||
if (this.authService.currentUserValue.dbOnStartup)
|
if (this.authService.currentUserValue.dbOnStartup)
|
||||||
|
|
@ -79,6 +81,7 @@ export class LoginComponent implements OnInit
|
||||||
|
|
||||||
ngOnInit(): void
|
ngOnInit(): void
|
||||||
{
|
{
|
||||||
|
debugger;
|
||||||
this.alertService.clear();
|
this.alertService.clear();
|
||||||
this.spinnerService.hide();
|
this.spinnerService.hide();
|
||||||
this.appVersion = packageJson.version;
|
this.appVersion = packageJson.version;
|
||||||
|
|
@ -132,6 +135,7 @@ export class LoginComponent implements OnInit
|
||||||
|
|
||||||
private loadLoginRemarks(): void
|
private loadLoginRemarks(): void
|
||||||
{
|
{
|
||||||
|
debugger;
|
||||||
const autId = this.fnSvc.cipherData(Api.cipherSecretKey ?? '');
|
const autId = this.fnSvc.cipherData(Api.cipherSecretKey ?? '');
|
||||||
this.authService.getLoginRemarks(autId).subscribe(
|
this.authService.getLoginRemarks(autId).subscribe(
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ export class AuthenticationService
|
||||||
|
|
||||||
constructor()
|
constructor()
|
||||||
{
|
{
|
||||||
|
debugger;
|
||||||
this.sessionEvent = new EventEmitter();
|
this.sessionEvent = new EventEmitter();
|
||||||
this.taskStatusEvent = new EventEmitter();
|
this.taskStatusEvent = new EventEmitter();
|
||||||
this.notificationEvent = new EventEmitter();
|
this.notificationEvent = new EventEmitter();
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,9 @@ import { inject, Injectable } from '@angular/core';
|
||||||
|
|
||||||
import { Base } from '../base/base';
|
import { Base } from '../base/base';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
export class UserService extends Base
|
export class UserService extends Base
|
||||||
{
|
{
|
||||||
public addUser(params: any)
|
public addUser(params: any)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user