refactor roll call case history controller and add total working hours endpoint
This commit is contained in:
@@ -6,12 +6,12 @@ using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Areas.Client.Controllers.RollCall;
|
||||
|
||||
public class CaseHistoryController : ClientBaseController
|
||||
public class RollCallCaseHistoryController : ClientBaseController
|
||||
{
|
||||
private readonly IRollCallApplication _rollCallApplication;
|
||||
private readonly long _workshopId;
|
||||
|
||||
public CaseHistoryController(IRollCallApplication rollCallApplication,
|
||||
public RollCallCaseHistoryController(IRollCallApplication rollCallApplication,
|
||||
IAuthHelper authHelper)
|
||||
{
|
||||
_rollCallApplication = rollCallApplication;
|
||||
@@ -51,6 +51,48 @@ public class CaseHistoryController : ClientBaseController
|
||||
return await _rollCallApplication.GetCaseHistoryDetails(_workshopId, titleId, searchModel);
|
||||
}
|
||||
|
||||
[HttpGet("total-working")]
|
||||
public ActionResult<OperationResult<string>> OnGetTotalWorking(
|
||||
string startDate,
|
||||
string startTime,
|
||||
string endDate,
|
||||
string endTime)
|
||||
{
|
||||
var op = new OperationResult<string>();
|
||||
const string emptyValue = "-";
|
||||
|
||||
if (!TryParseDateTime(startDate, startTime, out var start) ||
|
||||
!TryParseDateTime(endDate, endTime, out var end))
|
||||
{
|
||||
return op.Succcedded(emptyValue);
|
||||
}
|
||||
|
||||
if (start >= end)
|
||||
{
|
||||
return op.Succcedded(emptyValue);
|
||||
}
|
||||
|
||||
var duration = (end - start).ToFarsiHoursAndMinutes(emptyValue);
|
||||
return op.Succcedded(duration);
|
||||
}
|
||||
|
||||
private static bool TryParseDateTime(string date, string time, out DateTime result)
|
||||
{
|
||||
result = default;
|
||||
|
||||
try
|
||||
{
|
||||
var dateTime = date.ToGeorgianDateTime();
|
||||
var timeOnly = TimeOnly.Parse(time);
|
||||
result = dateTime.AddTicks(timeOnly.Ticks);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// [HttpGet("excel")]
|
||||
// public async Task<IActionResult> GetDownload(string titleId,RollCallCaseHistorySearchModel searchModel)
|
||||
// {
|
||||
@@ -82,5 +124,4 @@ public class CaseHistoryController : ClientBaseController
|
||||
// TotalRollCallsDuration = total.ToFarsiHoursAndMinutes("-")
|
||||
// };
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -251,8 +251,6 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
var hours = (int)span.TotalHours;
|
||||
var minutes = span.Minutes;
|
||||
|
||||
|
||||
|
||||
if (hours > 0 && minutes > 0)
|
||||
{
|
||||
return new JsonResult(new
|
||||
|
||||
@@ -42,6 +42,15 @@ public class GeneralController : GeneralBaseController
|
||||
currentDate
|
||||
});
|
||||
}
|
||||
[HttpGet("persian-day-of-week")]
|
||||
public ActionResult<OperationResult<string>> OnGetDayOfWeek(string dateFa)
|
||||
{
|
||||
var op = new OperationResult<string>();
|
||||
if (!dateFa.TryToGeorgianDateTime(out DateTime date))
|
||||
return op.Failed("تاریخ وارد شده نامعتبر است");
|
||||
|
||||
return op.Succcedded(date.DayOfWeek.DayOfWeeKToPersian());
|
||||
}
|
||||
|
||||
// [HttpGet("pm-permissions")]
|
||||
// public IActionResult GetPMPermissions()
|
||||
@@ -96,44 +105,8 @@ public class GeneralController : GeneralBaseController
|
||||
var statusCode = isSuccess ? "1" : "0";
|
||||
return $"{baseUrl}/callback?Status={statusCode}&transactionId={transactionId}";
|
||||
}
|
||||
}
|
||||
|
||||
public class TokenReq
|
||||
{
|
||||
public long Amount { get; set; }
|
||||
|
||||
public string CallbackUrl { get; set; }
|
||||
|
||||
[Display(Name = "شماره فاکتور")]
|
||||
[MaxLength(100)]
|
||||
[Required]
|
||||
[Key]
|
||||
// be ezaye har pazirande bayad yekta bashad
|
||||
public string invoiceID { get; set; }
|
||||
|
||||
[Required] public long terminalID { get; set; }
|
||||
|
||||
/*
|
||||
* JSON Bashad
|
||||
* etelaate takmili site harchi
|
||||
* nabayad char khas dashte bashe (*'"xp_%!+- ...)
|
||||
*/
|
||||
public string Payload { get; set; } = "";
|
||||
public string email { get; set; }
|
||||
}
|
||||
|
||||
public class TokenResp
|
||||
{
|
||||
// if 0 = success
|
||||
public int Status { get; set; }
|
||||
public string AccessToken { get; set; }
|
||||
}
|
||||
|
||||
public class PayRequest
|
||||
{
|
||||
[Required] [MaxLength(3000)] public string token { get; set; }
|
||||
[Required] public long terminalID { get; set; }
|
||||
public string nationalCode { get; set; }
|
||||
}
|
||||
|
||||
public class SepehrGatewayPayResponse
|
||||
@@ -170,9 +143,3 @@ public class SepehrGatewayPayResponse
|
||||
|
||||
[Display(Name = " شماره کارت ")] public string cardnumber { get; set; }
|
||||
}
|
||||
|
||||
public class AdviceReq
|
||||
{
|
||||
[Display(Name = " رسید دیجیتال ")] public string digitalreceipt { get; set; }
|
||||
public long Tid { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user