242 lines
11 KiB
C#
242 lines
11 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using SuperMap.RealEstate.ServiceModel;
|
||
using Business = SuperMap.RealEstate.Contract.Running.Business;
|
||
using HZQR.Common;
|
||
|
||
namespace EShang.Common.GeneralMethod
|
||
{
|
||
/// <summary>
|
||
/// 报销审核相关方法
|
||
/// 2023/10/12 16:34:58自动生成
|
||
/// </summary>
|
||
public class APPLYAPPROVEHelper
|
||
{
|
||
#region 获取报销审核列表
|
||
/// <summary>
|
||
/// 获取报销审核列表
|
||
/// </summary>
|
||
/// <param name="transaction">事务管理器</param>
|
||
/// <param name="TotalCount">查询结果总数</param>
|
||
/// <param name="searchModel">查询条件对象</param>
|
||
public static List<Model.APPLYAPPROVEModel> GetAPPLYAPPROVEList(Transaction transaction,
|
||
ref int TotalCount, Model.SearchModel<Model.APPLYAPPROVEModel> searchModel)
|
||
{
|
||
List<Model.APPLYAPPROVEModel> APPLYAPPROVEList = new List<Model.APPLYAPPROVEModel>();
|
||
|
||
string WhereSQL = "", RowFilterSQL = "";
|
||
if (searchModel.SearchParameter != null)
|
||
{
|
||
WhereSQL = OperationDataHelper<Model.APPLYAPPROVEModel>.GetWhereSQL(searchModel.SearchParameter, searchModel.QueryType);
|
||
if (WhereSQL != "")
|
||
{
|
||
WhereSQL = "WHERE " + WhereSQL;
|
||
}
|
||
}
|
||
|
||
DataTable dtAPPLYAPPROVE = new Business.APPLYAPPROVE(transaction).FillDataTable(WhereSQL);
|
||
//增加组合查询条件
|
||
if (searchModel.keyWord != null && !string.IsNullOrWhiteSpace(searchModel.keyWord.Key))
|
||
{
|
||
foreach (string KeyName in searchModel.keyWord.Key.Split(','))
|
||
{
|
||
RowFilterSQL += (RowFilterSQL == "" ? "" : " or ") +
|
||
KeyName + " like '%" + searchModel.keyWord.Value + "%'";
|
||
}
|
||
}
|
||
if (RowFilterSQL != "")
|
||
{
|
||
dtAPPLYAPPROVE.DefaultView.RowFilter = RowFilterSQL;
|
||
}
|
||
//排序:
|
||
dtAPPLYAPPROVE.DefaultView.Sort = searchModel.SortStr;
|
||
dtAPPLYAPPROVE = dtAPPLYAPPROVE.DefaultView.ToTable();
|
||
//获取查询结果总记录条数
|
||
TotalCount = dtAPPLYAPPROVE.Rows.Count;
|
||
//根据传入的页码和每页显示条数返回结果
|
||
dtAPPLYAPPROVE = CommonHelper.GetDataTableWithPageSize(dtAPPLYAPPROVE, searchModel.PageSize, searchModel.PageIndex);
|
||
|
||
foreach (DataRow drAPPLYAPPROVE in dtAPPLYAPPROVE.Rows)
|
||
{
|
||
Model.APPLYAPPROVEModel applyapproveModel = new Model.APPLYAPPROVEModel();
|
||
//绑定用户表数据对象
|
||
BindDataRowToModel(drAPPLYAPPROVE, applyapproveModel);
|
||
|
||
APPLYAPPROVEList.Add(applyapproveModel);
|
||
}
|
||
|
||
return APPLYAPPROVEList;
|
||
}
|
||
|
||
#region 绑定model
|
||
/// <summary>
|
||
/// 绑定model
|
||
/// </summary>
|
||
/// <param name="drAPPLYAPPROVE">datarow数据源</param>
|
||
/// <param name="applyapproveModel">model对象</param>
|
||
public static void BindDataRowToModel(DataRow drAPPLYAPPROVE, Model.APPLYAPPROVEModel applyapproveModel)
|
||
{
|
||
if (drAPPLYAPPROVE["APPLYAPPROVE_ID"].ToString() != "")
|
||
{
|
||
applyapproveModel.APPLYAPPROVE_ID = drAPPLYAPPROVE["APPLYAPPROVE_ID"].TryParseToInt(); //内码
|
||
}
|
||
if (drAPPLYAPPROVE["CONTRACTPROINST_ID"].ToString() != "")
|
||
{
|
||
applyapproveModel.CONTRACTPROINST_ID = drAPPLYAPPROVE["CONTRACTPROINST_ID"].TryParseToInt(); //实例内码
|
||
}
|
||
if (drAPPLYAPPROVE["ACTINST_ID"].ToString() != "")
|
||
{
|
||
applyapproveModel.ACTINST_ID = drAPPLYAPPROVE["ACTINST_ID"].TryParseToInt(); //环节内码
|
||
}
|
||
applyapproveModel.ACTINST_NAME = drAPPLYAPPROVE["ACTINST_NAME"].ToString(); //环节名称
|
||
if (drAPPLYAPPROVE["APPROVE_TYPE"].ToString() != "")
|
||
{
|
||
applyapproveModel.APPROVE_TYPE = drAPPLYAPPROVE["APPROVE_TYPE"].TryParseToInt(); //审批意见类型
|
||
}
|
||
if (drAPPLYAPPROVE["APPROVE_POSITION"].ToString() != "")
|
||
{
|
||
applyapproveModel.APPROVE_POSITION = drAPPLYAPPROVE["APPROVE_POSITION"].TryParseToShort(); //审批人职位
|
||
}
|
||
applyapproveModel.APPROVE_INFO = drAPPLYAPPROVE["APPROVE_INFO"].ToString(); //意见内容
|
||
if (drAPPLYAPPROVE["STAFF_ID"].ToString() != "")
|
||
{
|
||
applyapproveModel.STAFF_ID = drAPPLYAPPROVE["STAFF_ID"].TryParseToInt(); //操作人内码
|
||
}
|
||
applyapproveModel.STAFF_NAME = drAPPLYAPPROVE["STAFF_NAME"].ToString(); //操作人名
|
||
if (drAPPLYAPPROVE["APPROVE_DATE"].ToString() != "")
|
||
{
|
||
applyapproveModel.APPROVE_DATE = drAPPLYAPPROVE["APPROVE_DATE"].TryParseToLong(); //意见日期
|
||
}
|
||
if (drAPPLYAPPROVE["APPROVE_STATE"].ToString() != "")
|
||
{
|
||
applyapproveModel.APPROVE_STATE = drAPPLYAPPROVE["APPROVE_STATE"].TryParseToShort(); //审批状态
|
||
}
|
||
if (drAPPLYAPPROVE["APPROVE_MARK"].ToString() != "")
|
||
{
|
||
applyapproveModel.APPROVE_MARK = drAPPLYAPPROVE["APPROVE_MARK"].TryParseToShort(); //审批标志(0:PC;1:小程序)
|
||
}
|
||
applyapproveModel.APPROVE_DESC = drAPPLYAPPROVE["APPROVE_DESC"].ToString(); //备注
|
||
}
|
||
#endregion
|
||
|
||
#endregion
|
||
|
||
#region 获取报销审核明细
|
||
/// <summary>
|
||
/// 获取报销审核明细
|
||
/// </summary>
|
||
/// <param name="transaction">事务管理器</param>
|
||
/// <param name="APPLYAPPROVEId">报销审核内码</param>
|
||
public static Model.APPLYAPPROVEModel GetAPPLYAPPROVEDetail(Transaction transaction, int APPLYAPPROVEId)
|
||
{
|
||
Model.APPLYAPPROVEModel applyapproveModel = new Model.APPLYAPPROVEModel();
|
||
|
||
Business.APPLYAPPROVE _APPLYAPPROVE = new Business.APPLYAPPROVE(transaction);
|
||
_APPLYAPPROVE.APPLYAPPROVE_ID = APPLYAPPROVEId;
|
||
if (_APPLYAPPROVE.Select())
|
||
{
|
||
applyapproveModel.APPLYAPPROVE_ID = _APPLYAPPROVE.APPLYAPPROVE_ID; //内码
|
||
applyapproveModel.CONTRACTPROINST_ID = _APPLYAPPROVE.CONTRACTPROINST_ID; //实例内码
|
||
applyapproveModel.ACTINST_ID = _APPLYAPPROVE.ACTINST_ID; //环节内码
|
||
applyapproveModel.ACTINST_NAME = _APPLYAPPROVE.ACTINST_NAME; //环节名称
|
||
applyapproveModel.APPROVE_TYPE = _APPLYAPPROVE.APPROVE_TYPE; //审批意见类型
|
||
applyapproveModel.APPROVE_POSITION = _APPLYAPPROVE.APPROVE_POSITION; //审批人职位
|
||
applyapproveModel.APPROVE_INFO = _APPLYAPPROVE.APPROVE_INFO; //意见内容
|
||
applyapproveModel.STAFF_ID = _APPLYAPPROVE.STAFF_ID; //操作人内码
|
||
applyapproveModel.STAFF_NAME = _APPLYAPPROVE.STAFF_NAME; //操作人名
|
||
applyapproveModel.APPROVE_DATE = _APPLYAPPROVE.APPROVE_DATE; //意见日期
|
||
applyapproveModel.APPROVE_STATE = _APPLYAPPROVE.APPROVE_STATE; //审批状态
|
||
applyapproveModel.APPROVE_MARK = _APPLYAPPROVE.APPROVE_MARK; //审批标志(0:PC;1:小程序)
|
||
applyapproveModel.APPROVE_DESC = _APPLYAPPROVE.APPROVE_DESC; //备注
|
||
}
|
||
|
||
return applyapproveModel;
|
||
}
|
||
#endregion
|
||
|
||
#region 同步报销审核
|
||
/// <summary>
|
||
/// 赋值报销审核数据对象
|
||
/// </summary>
|
||
/// <param name="transaction">事务管理器</param>
|
||
/// <param name="applyapproveModel">报销审核数据对象</param>
|
||
public static bool SynchroAPPLYAPPROVE(Transaction transaction, Model.APPLYAPPROVEModel applyapproveModel)
|
||
{
|
||
bool SynchroFlag = true;
|
||
|
||
Business.APPLYAPPROVE _APPLYAPPROVE = new Business.APPLYAPPROVE(transaction);
|
||
if (applyapproveModel.APPLYAPPROVE_ID != null)
|
||
{
|
||
_APPLYAPPROVE.APPLYAPPROVE_ID = applyapproveModel.APPLYAPPROVE_ID;
|
||
if (_APPLYAPPROVE.Select())
|
||
{
|
||
SynchroModelToObject(_APPLYAPPROVE, applyapproveModel);
|
||
_APPLYAPPROVE.Update();
|
||
}
|
||
else
|
||
{
|
||
SynchroFlag = false;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
SynchroModelToObject(_APPLYAPPROVE, applyapproveModel);
|
||
_APPLYAPPROVE.Insert();
|
||
}
|
||
|
||
return SynchroFlag;
|
||
}
|
||
|
||
#region 赋值报销审核数据对象
|
||
/// <summary>
|
||
/// 赋值报销审核数据对象
|
||
/// </summary>
|
||
/// <param name="_APPLYAPPROVE"></param>
|
||
/// <param name="applyapproveModel"></param>
|
||
public static void SynchroModelToObject(Business.APPLYAPPROVE _APPLYAPPROVE, Model.APPLYAPPROVEModel applyapproveModel)
|
||
{
|
||
_APPLYAPPROVE.CONTRACTPROINST_ID = applyapproveModel.CONTRACTPROINST_ID; //实例内码
|
||
_APPLYAPPROVE.ACTINST_ID = applyapproveModel.ACTINST_ID; //环节内码
|
||
_APPLYAPPROVE.ACTINST_NAME = applyapproveModel.ACTINST_NAME; //环节名称
|
||
_APPLYAPPROVE.APPROVE_TYPE = applyapproveModel.APPROVE_TYPE; //审批意见类型
|
||
_APPLYAPPROVE.APPROVE_POSITION = applyapproveModel.APPROVE_POSITION; //审批人职位
|
||
_APPLYAPPROVE.APPROVE_INFO = applyapproveModel.APPROVE_INFO; //意见内容
|
||
_APPLYAPPROVE.STAFF_ID = applyapproveModel.STAFF_ID; //操作人内码
|
||
_APPLYAPPROVE.STAFF_NAME = applyapproveModel.STAFF_NAME; //操作人名
|
||
_APPLYAPPROVE.APPROVE_DATE = applyapproveModel.APPROVE_DATE; //意见日期
|
||
_APPLYAPPROVE.APPROVE_STATE = applyapproveModel.APPROVE_STATE; //审批状态
|
||
_APPLYAPPROVE.APPROVE_MARK = applyapproveModel.APPROVE_MARK; //审批标志(0:PC;1:小程序)
|
||
_APPLYAPPROVE.APPROVE_DESC = applyapproveModel.APPROVE_DESC; //备注
|
||
}
|
||
#endregion
|
||
|
||
#endregion
|
||
|
||
#region 删除报销审核
|
||
/// <summary>
|
||
/// 删除报销审核
|
||
/// </summary>
|
||
/// <param name="transaction">事务管理器</param>
|
||
/// <param name="APPLYAPPROVEId">报销审核内码</param>
|
||
public static bool DeleteAPPLYAPPROVE(Transaction transaction, int? APPLYAPPROVEId)
|
||
{
|
||
bool DeleteFlag = false;
|
||
|
||
if (APPLYAPPROVEId != null)
|
||
{
|
||
Business.APPLYAPPROVE _APPLYAPPROVE = new Business.APPLYAPPROVE(transaction);
|
||
_APPLYAPPROVE.APPLYAPPROVE_ID = APPLYAPPROVEId;
|
||
if (_APPLYAPPROVE.Select())
|
||
{
|
||
_APPLYAPPROVE.APPLYAPPROVE_STATE = 0;
|
||
DeleteFlag = _APPLYAPPROVE.Update();
|
||
}
|
||
}
|
||
|
||
return DeleteFlag;
|
||
}
|
||
#endregion
|
||
}
|
||
}
|