Create Employee Validation for InsuranceHistory
This commit is contained in:
@@ -880,7 +880,15 @@ public static class Tools
|
||||
}
|
||||
}
|
||||
|
||||
numbers = Convert.ToInt32(num);
|
||||
try
|
||||
{
|
||||
numbers = Convert.ToInt32(num);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return numbers;
|
||||
}
|
||||
public static string ToFarsiMonthByNumber(this string value)
|
||||
|
||||
@@ -222,6 +222,23 @@ public class IndexModel : PageModel
|
||||
if (string.IsNullOrWhiteSpace(command.MaritalStatus))
|
||||
return new JsonResult(result.Failed("لطفا وضعیت تاهل را مشخص نمایید"));
|
||||
|
||||
if (string.IsNullOrWhiteSpace(command.InsuranceHistoryByYear) || string.IsNullOrWhiteSpace(command.InsuranceHistoryByMonth))
|
||||
return new JsonResult(result.Failed("لطفا سابقه بیمه را مشخص نمایید"));
|
||||
if (command.InsuranceHistoryByYear != "0")
|
||||
{
|
||||
var insuranceYear = command.InsuranceHistoryByYear.ExtractIntNumbers();
|
||||
if(insuranceYear == 0)
|
||||
return new JsonResult(result.Failed("لطفا سال را به عدد وارد کنید"));
|
||||
}
|
||||
|
||||
if (command.InsuranceHistoryByMonth != "0")
|
||||
{
|
||||
var insuranceMonth = command.InsuranceHistoryByMonth.ExtractIntNumbers();
|
||||
if (insuranceMonth == 0)
|
||||
return new JsonResult(result.Failed("لطفا ماه را به عدد وارد کنید"));
|
||||
}
|
||||
|
||||
|
||||
result = _employeeApplication.Create(command);
|
||||
Thread.Sleep(1000);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user