Employee upload picture buge fixed
This commit is contained in:
@@ -10,6 +10,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Transactions;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
@@ -69,11 +70,17 @@ public class RollCallEmployeeApplication : IRollCallEmployeeApplication
|
||||
if (emp.HasUploadedImage == "false")
|
||||
return opreation.Failed("لطفا ابتدا عکس پرسنل را آپلود کنید");
|
||||
|
||||
emp.Active();
|
||||
using var transaction = new TransactionScope();
|
||||
|
||||
emp.Active();
|
||||
|
||||
var operation2 = _rollCallEmployeeStatusApplication.Create(new CreateRollCallEmployeeStatus() { RollCallEmployeeId = id });
|
||||
if (operation2.IsSuccedded == false)
|
||||
return operation2;
|
||||
_rollCallEmployeeRepository.SaveChanges();
|
||||
|
||||
_rollCallEmployeeRepository.SaveChanges();
|
||||
transaction.Complete();
|
||||
|
||||
return operation2;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace CompanyManagment.Application
|
||||
return op.Failed("کارمند مجاز نیست");
|
||||
|
||||
if (!_leftWorkRepository.Exists(x => x.EmployeeId == rollCallEmployee.EmployeeId && x.WorkshopId == rollCallEmployee.WorkshopId &&
|
||||
x.LeftWorkDate.Date > DateTime.Now.Date && x.StartWorkDate.Date < DateTime.Now.Date))
|
||||
x.LeftWorkDate.Date > DateTime.Now.Date && x.StartWorkDate.Date <= DateTime.Now.Date))
|
||||
return op.Failed("کارمند در کارگاه شروع به کار نکرده است");
|
||||
|
||||
if (_employeeRollCallStatusRepository.Exists(y =>
|
||||
@@ -61,6 +61,10 @@ namespace CompanyManagment.Application
|
||||
|
||||
public bool HasRollCallRecord(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd)
|
||||
{
|
||||
//موقت
|
||||
//یکتا تجارت گیل
|
||||
if(workshopId == 108)
|
||||
return false;
|
||||
var service = _rollCallServiceRepository.GetAllServiceByWorkshopId(workshopId);
|
||||
|
||||
if (!service.Any(x => x.StartService.Date <= contractStart.Date && x.EndService.Date >= contractEnd.Date))
|
||||
|
||||
@@ -10,6 +10,8 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using System.Diagnostics;
|
||||
using System.Security.Claims;
|
||||
using System.Text.Json;
|
||||
using System.Transactions;
|
||||
|
||||
namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
{
|
||||
@@ -294,6 +296,13 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
IsSuccedded = false,
|
||||
Message = "هنوز عملیاتی انجام نشده است"
|
||||
};
|
||||
var result2 = new OperationResult()
|
||||
{
|
||||
IsSuccedded = false,
|
||||
Message = "هنوز عملیاتی انجام نشده است"
|
||||
};
|
||||
using var transaction = new TransactionScope();
|
||||
|
||||
if (rollCallEmployee == null)
|
||||
{
|
||||
var createCommand = new CreateRollCallEmployee()
|
||||
@@ -304,7 +313,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
HasUploadedImage = "true",
|
||||
};
|
||||
result = _rollCallEmployeeApplication.Create(createCommand);
|
||||
_rollCallEmployeeStatusApplication.Create(new CreateRollCallEmployeeStatus()
|
||||
result2=_rollCallEmployeeStatusApplication.Create(new CreateRollCallEmployeeStatus()
|
||||
{ RollCallEmployeeId = result.SendId });
|
||||
}
|
||||
else
|
||||
@@ -312,8 +321,9 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
result = _rollCallEmployeeApplication.UploadedImage(employeeId, workshopId);
|
||||
}
|
||||
|
||||
if (result.IsSuccedded)
|
||||
if (result.IsSuccedded && result2.IsSuccedded)
|
||||
{
|
||||
transaction.Complete();
|
||||
return new JsonResult(new
|
||||
{
|
||||
IsSuccedded = result.IsSuccedded,
|
||||
@@ -323,11 +333,18 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
}
|
||||
else
|
||||
{
|
||||
return new JsonResult(new
|
||||
{
|
||||
IsSuccedded = result.IsSuccedded,
|
||||
Message = result.Message,
|
||||
});
|
||||
if(result.IsSuccedded==false)
|
||||
return new JsonResult(new
|
||||
{
|
||||
IsSuccedded = result.IsSuccedded,
|
||||
Message = result.Message,
|
||||
});
|
||||
else
|
||||
return new JsonResult(new
|
||||
{
|
||||
IsSuccedded = result2.IsSuccedded,
|
||||
Message = result2.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
Reference in New Issue
Block a user