@ -199,5 +199,362 @@ namespace _24Hour.Controllers.Common
return result ;
}
# endregion
#region 远程会见管理
/// <summary>
/// 根据当前登录人查询远程会见信息分页查询
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
[HttpPost]
[Route("QueryRemoteuser")]
public async Task < Result > QueryRemoteuser ( App_RemoteInput Remotedata )
{
var Receptionlist = new List < App_RemoteModel > ( ) ;
//查询远程会见记录
var list = await _d b . Queryable < App_RemoteModel > ( )
. WhereIF ( Remotedata . Code ! = null , q = > q . Code . Contains ( Remotedata . Code ) )
. WhereIF ( Remotedata . name ! = null , q = > q . name . Contains ( Remotedata . name ) )
. WhereIF ( Remotedata . meetwitname ! = null , q = > q . meetwitname . Contains ( Remotedata . meetwitname ) )
. WhereIF ( Remotedata . state ! = null , q = > q . state = = Remotedata . state )
. Where ( q = > q . IsDeleted = = 0 & & q . unitId = = _ userdata . unitCode ) . ToPageListAsync ( Remotedata . PageIndex , Remotedata . PageSize ) ;
var data = new QueryResult < App_RemoteModel > ( Remotedata , list . OrderByDescending ( q = > q . creationtime ) . ToList ( ) ) ;
result . IsSucceed = true ;
result . result = data ;
return result ;
}
/// <summary>
/// 远程会见分页查询
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
[HttpPost]
[Route("QueryRemote")]
public async Task < Result > QueryRemote ( App_RemoteInput Remotedata )
{
var Receptionlist = new List < App_RemoteModel > ( ) ;
//查询远程会见记录
var list = await _d b . Queryable < App_RemoteModel > ( )
. WhereIF ( Remotedata . Code ! = null , q = > q . Code . Contains ( Remotedata . Code ) )
. WhereIF ( Remotedata . name ! = null , q = > q . name . Contains ( Remotedata . name ) )
. WhereIF ( Remotedata . meetwitname ! = null , q = > q . meetwitname . Contains ( Remotedata . meetwitname ) )
. WhereIF ( Remotedata . state ! = null , q = > q . state = = Remotedata . state )
. Where ( q = > q . IsDeleted = = 0 ) . ToPageListAsync ( Remotedata . PageIndex , Remotedata . PageSize ) ;
var data = new QueryResult < App_RemoteModel > ( Remotedata , list . OrderByDescending ( q = > q . creationtime ) . ToList ( ) ) ;
result . IsSucceed = true ;
result . result = data ;
return result ;
}
/// <summary>
/// 添加远程会见
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
[HttpPost]
[Route("AddRemote")]
public async Task < Result > AddRemote ( App_RemoteModel Remotedata )
{
try
{
_d b . BeginTran ( ) ;
Remotedata . Id = Guid . NewGuid ( ) . ToString ( ) ;
Remotedata . unitId = _ userdata . unitCode . ToString ( ) ;
Remotedata . createuserId = _ userdata . Id . ToString ( ) ;
Remotedata . createusername = _ userdata . name ;
var num = await _d b . Insertable ( Remotedata ) . ExecuteCommandAsync ( ) ;
_d b . CommitTran ( ) ;
if ( num > 0 )
{
result . IsSucceed = true ;
result . result = "添加成功" ;
}
}
catch ( System . Exception ex )
{
_d b . RollbackTran ( ) ;
result . IsSucceed = false ;
result . Message = ex . Message ;
}
_l ogs . WriteSysLogadd ( "远程会见管理" , "添加远程会见" , result , _d b ) ;
return result ;
}
/// <summary>
/// 修改远程会见
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
[HttpPost]
[Route("UpdateRemote")]
public async Task < Result > UpdateRemote ( App_RemoteModel Remotedata )
{
try
{
_d b . BeginTran ( ) ;
var num = await _d b . Updateable ( Remotedata ) . IgnoreColumns ( ignoreAllNullColumns : true ) . ExecuteCommandAsync ( ) ;
_d b . CommitTran ( ) ;
if ( num > 0 )
{
result . IsSucceed = true ;
result . result = "修改成功" ;
}
}
catch ( System . Exception ex )
{
_d b . RollbackTran ( ) ;
result . IsSucceed = false ;
result . Message = ex . Message ;
}
_l ogs . WriteSysLogadd ( "远程会见管理" , "修改远程会见" , result , _d b ) ;
return result ;
}
/// <summary>
/// 删除远程会见
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
[HttpPost]
[Route("DeleteRemote")]
public async Task < Result > DeleteRemote ( CurrencyDelete Currency )
{
try
{
_d b . BeginTran ( ) ;
var Receptionlist = await _d b . Queryable < App_RemoteModel > ( ) . In ( q = > q . Id , Currency . id ) . ToListAsync ( ) ;
Receptionlist . ForEach ( q = >
{
q . IsDeleted = 1 ;
} ) ;
var num = await _d b . Updateable ( Receptionlist ) . ExecuteCommandAsync ( ) ;
_d b . CommitTran ( ) ;
if ( num > 0 )
{
result . IsSucceed = true ;
result . result = "删除成功" ;
}
}
catch ( System . Exception ex )
{
_d b . RollbackTran ( ) ;
result . IsSucceed = false ;
result . Message = ex . Message ;
}
_l ogs . WriteSysLogadd ( "远程会见管理" , "删除远程会见" , result , _d b ) ;
return result ;
}
/// <summary>
/// 结束远程会见
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
[HttpPost]
[Route("UpdateRemote_state")]
public async Task < Result > UpdateRemote_state ( CurrencyDelete Currency )
{
try
{
var Receptionlist = await _d b . Queryable < App_RemoteModel > ( ) . Where ( q = > Currency . id . Contains ( q . Id ) ) . ToListAsync ( ) ;
Receptionlist . ForEach ( q = > { q . state = 1 ; } ) ;
_d b . BeginTran ( ) ;
var num = await _d b . Updateable ( Receptionlist ) . ExecuteCommandAsync ( ) ;
_d b . CommitTran ( ) ;
if ( num > 0 )
{
result . IsSucceed = true ;
result . result = "结束成功" ;
}
}
catch ( System . Exception ex )
{
_d b . RollbackTran ( ) ;
result . IsSucceed = false ;
result . Message = ex . Message ;
}
_l ogs . WriteSysLogadd ( "远程会见管理" , "结束远程会见" , result , _d b ) ;
return result ;
}
/// <summary>
/// 取消远程会见
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
[HttpPost]
[Route("Updatecancellation_state")]
public async Task < Result > Updatecancellation_state ( CurrencyDelete Currency )
{
try
{
var Receptionlist = await _d b . Queryable < App_RemoteModel > ( ) . Where ( q = > Currency . id . Contains ( q . Id ) ) . ToListAsync ( ) ;
Receptionlist . ForEach ( q = > { q . state = 2 ; } ) ;
_d b . BeginTran ( ) ;
var num = await _d b . Updateable ( Receptionlist ) . ExecuteCommandAsync ( ) ;
_d b . CommitTran ( ) ;
if ( num > 0 )
{
result . IsSucceed = true ;
result . result = "已取消" ;
}
}
catch ( System . Exception ex )
{
_d b . RollbackTran ( ) ;
result . IsSucceed = false ;
result . Message = ex . Message ;
}
_l ogs . WriteSysLogadd ( "远程会见管理" , "取消远程会见" , result , _d b ) ;
return result ;
}
# endregion
#region 设备管理
/// <summary>
/// 根据当前登录人查询设备信息分页查询
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
[HttpPost]
[Route("QueryDeviceuser")]
public async Task < Result > QueryDeviceuser ( App_DeviceInput Devicedata )
{
var Receptionlist = new List < App_RemoteModel > ( ) ;
//查询远程会见记录
var list = await _d b . Queryable < App_RemoteModel > ( )
. WhereIF ( Devicedata . deviceno ! = null , q = > q . Code . Contains ( Devicedata . deviceno ) )
. WhereIF ( Devicedata . name ! = null , q = > q . name . Contains ( Devicedata . name ) )
. WhereIF ( Devicedata . state ! = null , q = > q . state = = Devicedata . state )
. Where ( q = > q . IsDeleted = = 0 & & q . unitId = = _ userdata . unitCode ) . ToPageListAsync ( Devicedata . PageIndex , Devicedata . PageSize ) ;
var data = new QueryResult < App_RemoteModel > ( Devicedata , list . OrderByDescending ( q = > q . creationtime ) . ToList ( ) ) ;
result . IsSucceed = true ;
result . result = data ;
return result ;
}
/// <summary>
/// 设备分页查询
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
[HttpPost]
[Route("QueryDevice")]
public async Task < Result > QueryDevice ( App_DeviceInput Devicedata )
{
var Receptionlist = new List < App_DeviceModel > ( ) ;
//查询远程会见记录
var list = await _d b . Queryable < App_DeviceModel > ( )
. WhereIF ( Devicedata . deviceno ! = null , q = > q . deviceno . Contains ( Devicedata . deviceno ) )
. WhereIF ( Devicedata . name ! = null , q = > q . name . Contains ( Devicedata . name ) )
. WhereIF ( Devicedata . state ! = null , q = > q . state = = Devicedata . state )
. Where ( q = > q . IsDeleted = = 0 ) . ToPageListAsync ( Devicedata . PageIndex , Devicedata . PageSize ) ;
var data = new QueryResult < App_DeviceModel > ( Devicedata , list . OrderByDescending ( q = > q . creationtime ) . ToList ( ) ) ;
result . IsSucceed = true ;
result . result = data ;
return result ;
}
/// <summary>
/// 添加设备
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
[HttpPost]
[Route("AddDevice")]
public async Task < Result > AddDevice ( App_DeviceModel Devicedata )
{
try
{
_d b . BeginTran ( ) ;
Devicedata . Id = Guid . NewGuid ( ) . ToString ( ) ;
Devicedata . unitId = _ userdata . unitCode . ToString ( ) ;
Devicedata . createuserId = _ userdata . Id . ToString ( ) ;
Devicedata . createusername = _ userdata . name ;
var num = await _d b . Insertable ( Devicedata ) . ExecuteCommandAsync ( ) ;
_d b . CommitTran ( ) ;
if ( num > 0 )
{
result . IsSucceed = true ;
result . result = "添加成功" ;
}
}
catch ( System . Exception ex )
{
_d b . RollbackTran ( ) ;
result . IsSucceed = false ;
result . Message = ex . Message ;
}
_l ogs . WriteSysLogadd ( "远程会见管理" , "添加远程会见" , result , _d b ) ;
return result ;
}
/// <summary>
/// 修改设备
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
[HttpPost]
[Route("UpdateDevice")]
public async Task < Result > UpdateDevice ( App_DeviceModel Devicedata )
{
try
{
_d b . BeginTran ( ) ;
var num = await _d b . Updateable ( Devicedata ) . IgnoreColumns ( ignoreAllNullColumns : true ) . ExecuteCommandAsync ( ) ;
_d b . CommitTran ( ) ;
if ( num > 0 )
{
result . IsSucceed = true ;
result . result = "修改成功" ;
}
}
catch ( System . Exception ex )
{
_d b . RollbackTran ( ) ;
result . IsSucceed = false ;
result . Message = ex . Message ;
}
_l ogs . WriteSysLogadd ( "远程会见管理" , "修改远程会见" , result , _d b ) ;
return result ;
}
/// <summary>
/// 删除设备
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
[HttpPost]
[Route("DeleteDevice")]
public async Task < Result > DeleteDevice ( CurrencyDelete Currency )
{
try
{
_d b . BeginTran ( ) ;
var Receptionlist = await _d b . Queryable < App_DeviceModel > ( ) . In ( q = > q . Id , Currency . id ) . ToListAsync ( ) ;
Receptionlist . ForEach ( q = >
{
q . IsDeleted = 1 ;
} ) ;
var num = await _d b . Updateable ( Receptionlist ) . ExecuteCommandAsync ( ) ;
_d b . CommitTran ( ) ;
if ( num > 0 )
{
result . IsSucceed = true ;
result . result = "删除成功" ;
}
}
catch ( System . Exception ex )
{
_d b . RollbackTran ( ) ;
result . IsSucceed = false ;
result . Message = ex . Message ;
}
_l ogs . WriteSysLogadd ( "设备管理" , "删除设备" , result , _d b ) ;
return result ;
}
# endregion
}
}