Compare commits
4 Commits
Feature/no
...
Feature/au
| Author | SHA1 | Date | |
|---|---|---|---|
| 3a32d1ca9d | |||
| 951a194961 | |||
| 3c0ec01f77 | |||
| 323a46a623 |
@@ -446,7 +446,7 @@ public class RollCallApplication : IRollCallApplication
|
||||
return operation.Failed("کارمند در بازه انتخاب شده مرخصی ساعتی دارد");
|
||||
}
|
||||
|
||||
if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.StartDate >= y.StartDateGr && x.EndDate <= y.EndDateGr)))
|
||||
if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.StartDate.Value.Date >= y.StartDateGr.Date && x.EndDate.Value.Date <= y.EndDateGr.Date)))
|
||||
return operation.Failed("کارمند در بازه وارد شده غیر فعال است");
|
||||
|
||||
|
||||
@@ -486,7 +486,8 @@ public class RollCallApplication : IRollCallApplication
|
||||
|
||||
|
||||
|
||||
if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.StartDate >= y.StartDateGr && x.EndDate <= y.EndDateGr)))
|
||||
if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.StartDate.Value.Date >= y.StartDateGr.Date
|
||||
&& x.EndDate.Value.Date <= y.EndDateGr.Date)))
|
||||
return operation.Failed("کارمند در بازه وارد شده غیر فعال است");
|
||||
|
||||
|
||||
@@ -630,7 +631,7 @@ public class RollCallApplication : IRollCallApplication
|
||||
return operation.Failed("کارمند در بازه انتخاب شده مرخصی ساعتی دارد");
|
||||
}
|
||||
|
||||
if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.StartDate >= y.StartDateGr && x.EndDate <= y.EndDateGr)))
|
||||
if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.StartDate.Value.Date >= y.StartDateGr.Date && x.EndDate.Value.Date <= y.EndDateGr.Date)))
|
||||
return operation.Failed("کارمند در بازه وارد شده غیر فعال است");
|
||||
|
||||
|
||||
@@ -662,7 +663,7 @@ public class RollCallApplication : IRollCallApplication
|
||||
&& (y.StartDate.Value.Date <= x.ContractEndGr.Date))))
|
||||
return operation.Failed("برای بازه های وارد شده فیش حقوقی ثبت شده است");
|
||||
|
||||
if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.StartDate >= y.StartDateGr && x.EndDate <= y.EndDateGr)))
|
||||
if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.StartDate.Value.Date >= y.StartDateGr.Date && x.EndDate.Value.Date <= y.EndDateGr.Date)))
|
||||
return operation.Failed("کارمند در بازه وارد شده غیر فعال است");
|
||||
|
||||
var currentDayRollCall = employeeRollCalls.FirstOrDefault(x => x.EndDate == null);
|
||||
|
||||
@@ -515,9 +515,16 @@
|
||||
اطلاعات بانکی طرف حساب
|
||||
</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a asp-area="AdminNew" asp-page="/Index" asp-page-handler="ProgramManager" class="waves-effect btnCustom">
|
||||
<div class="menuTitle">
|
||||
<i class="md md-home"></i>
|
||||
<span> پروگرام منیجر </span>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
@@ -7,6 +7,10 @@ using Company.Domain.WorkshopAccountAgg;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
using WorkFlow.Application.Contracts.AdminWorkFlow;
|
||||
|
||||
namespace ServiceHost.Areas.AdminNew.Pages
|
||||
@@ -121,5 +125,51 @@ namespace ServiceHost.Areas.AdminNew.Pages
|
||||
data = checkerCount,
|
||||
});
|
||||
}
|
||||
|
||||
public IActionResult OnGetProgramManager()
|
||||
{
|
||||
try
|
||||
{
|
||||
// دریافت اطلاعات کاربر فعلی
|
||||
var currentAccountId = _authHelper.CurrentAccountId();
|
||||
var accountInfo = _authHelper.CurrentAccountInfo();
|
||||
|
||||
// تعریف Secret Key برای JWT (باید در appsettings.json تعریف شود)
|
||||
var secretKey = _configuration["JwtSettings:SecretKey"] ?? ">3£>^1UBG@yw)QdhRC3$£:;r8~?qpp^oKK4D3a~8L2>enF;lkgh";
|
||||
var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(secretKey));
|
||||
var credentials = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);
|
||||
|
||||
// ایجاد Claims
|
||||
var claims = new[]
|
||||
{
|
||||
new Claim(ClaimTypes.NameIdentifier, currentAccountId.ToString()),
|
||||
new Claim(ClaimTypes.Name, accountInfo.Fullname ?? ""),
|
||||
new Claim(ClaimTypes.Email, accountInfo.Username ?? ""),
|
||||
new Claim("AccountId", currentAccountId.ToString()),
|
||||
new Claim("RoleId", accountInfo.RoleId.ToString())
|
||||
};
|
||||
|
||||
// ایجاد JWT Token
|
||||
var token = new JwtSecurityToken(
|
||||
issuer: _configuration["JwtSettings:Issuer"] ?? "GozareshgirApp",
|
||||
audience: _configuration["JwtSettings:Audience"] ?? "GozareshgirUsers",
|
||||
claims: claims,
|
||||
expires: DateTime.UtcNow.AddMinutes(int.Parse(_configuration["JwtSettings:ExpirationMinutes"] ?? "30")),
|
||||
signingCredentials: credentials
|
||||
);
|
||||
|
||||
var tokenString = new JwtSecurityTokenHandler().WriteToken(token);
|
||||
var domain = _configuration["GozareshgirProgramManager:Domain"] ?? "http://localhost:5000";
|
||||
// Redirect به SSO-Login با Token
|
||||
var ssoUrl = $"https://pm{domain}/ssologin?token={Uri.EscapeDataString(tokenString)}";
|
||||
// var ssoUrl = $"https://localhost:7032/api/Auth/sso-login?token={Uri.EscapeDataString(tokenString)}";
|
||||
return Redirect(ssoUrl);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// در صورت خطا، برگشت به صفحه اصلی
|
||||
return RedirectToPage("/Index");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -663,8 +663,14 @@
|
||||
اطلاعات بانکی طرف حساب
|
||||
</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a asp-area="AdminNew" asp-page="/Index" asp-page-handler="ProgramManager" class="waves-effect btnCustom">
|
||||
<div class="menuTitle">
|
||||
<i class="md md-home"></i>
|
||||
<span> پروگرام منیجر </span>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
@@ -48,7 +48,13 @@
|
||||
//, "09116067106", "09114221321"
|
||||
]
|
||||
},
|
||||
"SepehrGateWayTerminalId": 99213700
|
||||
"SepehrGateWayTerminalId": 99213700,
|
||||
"JwtSettings": {
|
||||
"SecretKey": ">3£>^1UBG@yw)QdhRC3$£:;r8~?qpp^oKK4D3a~8L2>enF;lkgh",
|
||||
"Issuer": "GozareshgirApp",
|
||||
"Audience": "GozareshgirUsers",
|
||||
"ExpirationMinutes": 30
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
//"MesbahDb": "Data Source=.\\MSSQLSERVER2019;Initial Catalog=mesbah_db;Persist Security Info=False;User ID=mesbah_db;Password=sa142857$@;"
|
||||
//"MesbahDb": "Data Source=.\\MSSQLSERVER2019;Initial Catalog=mesbah_db;Persist Security Info=False;User ID=mesbah_db;Password=sa142857$@;"
|
||||
"MesbahDb": "Data Source=.;Initial Catalog=mesbah_db;Integrated Security=True;TrustServerCertificate=true;",
|
||||
|
||||
//dad-mehr
|
||||
@@ -36,6 +36,11 @@
|
||||
"IsTestMode": false,
|
||||
"TestNumbers": []
|
||||
},
|
||||
"SepehrGateWayTerminalId": 99213700
|
||||
|
||||
"SepehrGateWayTerminalId": 99213700,
|
||||
"JwtSettings": {
|
||||
"SecretKey": ">3£>^1UBG@yw)QdhRC3$£:;r8~?qpp^oKK4D3a~8L2>enF;lkgh",
|
||||
"Issuer": "GozareshgirApp",
|
||||
"Audience": "GozareshgirUsers",
|
||||
"ExpirationMinutes": 30
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user