324 lines
16 KiB
C#
324 lines
16 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using SuperMap.RealEstate.ServiceModel;
|
||
using Business = SuperMap.RealEstate.HighWay.Storage.Business;
|
||
using HCC = HZQR.Common.Common;
|
||
using HZQR.Common;
|
||
|
||
namespace EShang.Common.GeneralMethod
|
||
{
|
||
/// <summary>
|
||
/// 服务区信息表相关方法
|
||
/// 2024/8/7 15:26:45自动生成
|
||
/// </summary>
|
||
public class SERVERPARTHelper
|
||
{
|
||
#region 获取服务区信息表列表
|
||
/// <summary>
|
||
/// 获取服务区信息表列表
|
||
/// </summary>
|
||
/// <param name="transaction">事务管理器</param>
|
||
/// <param name="TotalCount">查询结果总数</param>
|
||
/// <param name="searchModel">查询条件对象</param>
|
||
public static List<Model.SERVERPARTModel> GetSERVERPARTList(Transaction transaction,
|
||
ref int TotalCount, Model.SearchModel<Model.SERVERPARTModel> searchModel)
|
||
{
|
||
List<Model.SERVERPARTModel> SERVERPARTList = new List<Model.SERVERPARTModel>();
|
||
|
||
string WhereSQL = "", RowFilterSQL = "";
|
||
if (searchModel.SearchParameter != null)
|
||
{
|
||
WhereSQL = OperationDataHelper<Model.SERVERPARTModel>.GetWhereSQL(searchModel.SearchParameter, searchModel.QueryType, "",
|
||
"SERVERPART_IDS", "SERVERPART_CODES", "SPREGIONTYPE_IDS", "OWNERUNIT_IDS");
|
||
if (WhereSQL != "")
|
||
{
|
||
WhereSQL = " WHERE " + WhereSQL;
|
||
}
|
||
//查询服务区内码
|
||
if (searchModel.SearchParameter.SERVERPART_IDS.TryParseToString() != "")
|
||
{
|
||
WhereSQL += (WhereSQL == "" ? " WHERE " : " AND ") + "SERVERPART_ID IN (" + searchModel.SearchParameter.SERVERPART_IDS + ")";
|
||
}
|
||
//查询服务区编码
|
||
if (searchModel.SearchParameter.SERVERPART_CODES.TryParseToString() != "")
|
||
{
|
||
WhereSQL += (WhereSQL == "" ? " WHERE " : " AND ") + "SERVERPART_CODE IN ('" +
|
||
searchModel.SearchParameter.SERVERPART_CODES.Replace(",", "','") + "')";
|
||
}
|
||
//查询片区内码
|
||
if (searchModel.SearchParameter.SPREGIONTYPE_IDS.TryParseToString() != "")
|
||
{
|
||
WhereSQL += (WhereSQL == "" ? " WHERE " : " AND ") + "SPREGIONTYPE_ID IN (" + searchModel.SearchParameter.SPREGIONTYPE_IDS + ")";
|
||
}
|
||
//查询业主单位内码
|
||
if (searchModel.SearchParameter.OWNERUNIT_IDS.TryParseToString() != "")
|
||
{
|
||
WhereSQL += (WhereSQL == "" ? " WHERE " : " AND ") + "OWNERUNIT_ID IN (" + searchModel.SearchParameter.OWNERUNIT_IDS + ")";
|
||
}
|
||
}
|
||
|
||
DataTable dtSERVERPART = new Business.HIGHWAYPROINST(transaction).ExecuteDataTable(
|
||
"SELECT * FROM HIGHWAY_STORAGE.T_SERVERPART" + 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 != "")
|
||
{
|
||
dtSERVERPART.DefaultView.RowFilter = RowFilterSQL;
|
||
}
|
||
//排序:
|
||
dtSERVERPART.DefaultView.Sort = searchModel.SortStr;
|
||
dtSERVERPART = dtSERVERPART.DefaultView.ToTable();
|
||
//获取查询结果总记录条数
|
||
TotalCount = dtSERVERPART.Rows.Count;
|
||
//根据传入的页码和每页显示条数返回结果
|
||
dtSERVERPART = CommonHelper.GetDataTableWithPageSize(dtSERVERPART, searchModel.PageSize, searchModel.PageIndex);
|
||
|
||
foreach (DataRow drSERVERPART in dtSERVERPART.Rows)
|
||
{
|
||
Model.SERVERPARTModel serverpartModel = new Model.SERVERPARTModel();
|
||
//绑定服务区信息表数据对象
|
||
BindDataRowToModel(drSERVERPART, serverpartModel);
|
||
|
||
SERVERPARTList.Add(serverpartModel);
|
||
}
|
||
|
||
return SERVERPARTList;
|
||
}
|
||
|
||
#region 绑定model
|
||
/// <summary>
|
||
/// 绑定model
|
||
/// </summary>
|
||
/// <param name="drSERVERPART">datarow数据源</param>
|
||
/// <param name="serverpartModel">model对象</param>
|
||
public static void BindDataRowToModel(DataRow drSERVERPART, Model.SERVERPARTModel serverpartModel)
|
||
{
|
||
if (drSERVERPART["SERVERPART_ID"].ToString() != "")
|
||
{
|
||
serverpartModel.SERVERPART_ID = drSERVERPART["SERVERPART_ID"].TryParseToInt(); //服务区内码
|
||
}
|
||
serverpartModel.SERVERPART_NAME = drSERVERPART["SERVERPART_NAME"].ToString(); //服务区名称
|
||
if (drSERVERPART["SERVERPART_INDEX"].ToString() != "")
|
||
{
|
||
serverpartModel.SERVERPART_INDEX = drSERVERPART["SERVERPART_INDEX"].TryParseToInt(); //服务区索引
|
||
}
|
||
serverpartModel.SERVERPART_CODE = drSERVERPART["SERVERPART_CODE"].ToString(); //服务区编码
|
||
if (drSERVERPART["PROVINCE_CODE"].ToString() != "")
|
||
{
|
||
serverpartModel.PROVINCE_CODE = drSERVERPART["PROVINCE_CODE"].TryParseToInt(); //省份内码
|
||
}
|
||
if (drSERVERPART["SPREGIONTYPE_ID"].ToString() != "")
|
||
{
|
||
serverpartModel.SPREGIONTYPE_ID = drSERVERPART["SPREGIONTYPE_ID"].TryParseToInt(); //片区内码
|
||
}
|
||
serverpartModel.SPREGIONTYPE_NAME = drSERVERPART["SPREGIONTYPE_NAME"].ToString(); //片区名字
|
||
if (drSERVERPART["SPREGIONTYPE_INDEX"].ToString() != "")
|
||
{
|
||
serverpartModel.SPREGIONTYPE_INDEX = drSERVERPART["SPREGIONTYPE_INDEX"].TryParseToInt(); //片区索引
|
||
}
|
||
serverpartModel.STATISTICS_TYPE = drSERVERPART["STATISTICS_TYPE"].ToString(); //站点类型(服务区、加油站、单位部门)
|
||
if (drSERVERPART["STATISTIC_TYPE"].ToString() != "")
|
||
{
|
||
serverpartModel.STATISTIC_TYPE = drSERVERPART["STATISTIC_TYPE"].TryParseToShort(); //统计类型(1000:正式,2000:测试,3000:替代)
|
||
}
|
||
if (drSERVERPART["SERVERPART_TYPE"].ToString() != "")
|
||
{
|
||
serverpartModel.SERVERPART_TYPE = drSERVERPART["SERVERPART_TYPE"].TryParseToInt(); //服务区类型
|
||
}
|
||
if (drSERVERPART["OWNERUNIT_ID"].ToString() != "")
|
||
{
|
||
serverpartModel.OWNERUNIT_ID = drSERVERPART["OWNERUNIT_ID"].TryParseToInt(); //业主单位内码
|
||
}
|
||
serverpartModel.OWNERUNIT_NAME = drSERVERPART["OWNERUNIT_NAME"].ToString(); //业主单位名称
|
||
serverpartModel.SERVERPART_ADDRESS = drSERVERPART["SERVERPART_ADDRESS"].ToString(); //服务区地址
|
||
serverpartModel.EXPRESSWAY_NAME = drSERVERPART["EXPRESSWAY_NAME"].ToString(); //服务区所在高速路
|
||
if (drSERVERPART["SELLERCOUNT"].ToString() != "")
|
||
{
|
||
serverpartModel.SELLERCOUNT = drSERVERPART["SELLERCOUNT"].TryParseToLong(); //商家服务数
|
||
}
|
||
if (drSERVERPART["SERVERPART_AREA"].ToString() != "")
|
||
{
|
||
serverpartModel.SERVERPART_AREA = drSERVERPART["SERVERPART_AREA"].TryParseToDouble(); //服务区面积
|
||
}
|
||
serverpartModel.SERVERPART_TEL = drSERVERPART["SERVERPART_TEL"].ToString(); //服务区电话号码
|
||
serverpartModel.SERVERPART_INFO = drSERVERPART["SERVERPART_INFO"].ToString(); //服务区说明
|
||
if (drSERVERPART["CITY_CODE"].ToString() != "")
|
||
{
|
||
serverpartModel.CITY_CODE = drSERVERPART["CITY_CODE"].TryParseToInt(); //城市编码
|
||
}
|
||
if (drSERVERPART["COUNTY_CODE"].ToString() != "")
|
||
{
|
||
serverpartModel.COUNTY_CODE = drSERVERPART["COUNTY_CODE"].TryParseToInt(); //区县编码
|
||
}
|
||
if (drSERVERPART["FIELDENUM_ID"].ToString() != "")
|
||
{
|
||
serverpartModel.FIELDENUM_ID = drSERVERPART["FIELDENUM_ID"].TryParseToInt(); //枚举内码
|
||
}
|
||
serverpartModel.SERVERPART_IPADDRESS = drSERVERPART["SERVERPART_IPADDRESS"].ToString(); //服务区IP地址描述
|
||
if (drSERVERPART["DAYINCAR"].ToString() != "")
|
||
{
|
||
serverpartModel.DAYINCAR = drSERVERPART["DAYINCAR"].TryParseToDouble(); //日均入区车辆
|
||
}
|
||
serverpartModel.HKBL = drSERVERPART["HKBL"].ToString(); //入区车辆客货比例
|
||
if (drSERVERPART["STARTDATE"].ToString() != "")
|
||
{
|
||
serverpartModel.STARTDATE = drSERVERPART["STARTDATE"].TryParseToDateTime(); //开业时间
|
||
}
|
||
serverpartModel.OWNEDCOMPANY = drSERVERPART["OWNEDCOMPANY"].ToString(); //所属公司
|
||
if (drSERVERPART["FLOORAREA"].ToString() != "")
|
||
{
|
||
serverpartModel.FLOORAREA = drSERVERPART["FLOORAREA"].TryParseToDouble(); //占地面积
|
||
}
|
||
if (drSERVERPART["BUSINESSAREA"].ToString() != "")
|
||
{
|
||
serverpartModel.BUSINESSAREA = drSERVERPART["BUSINESSAREA"].TryParseToDouble(); //经营面积
|
||
}
|
||
if (drSERVERPART["SHAREAREA"].ToString() != "")
|
||
{
|
||
serverpartModel.SHAREAREA = drSERVERPART["SHAREAREA"].TryParseToDouble(); //公共区域面积
|
||
}
|
||
if (drSERVERPART["TOTALPARKING"].ToString() != "")
|
||
{
|
||
serverpartModel.TOTALPARKING = drSERVERPART["TOTALPARKING"].TryParseToInt(); //车位数
|
||
}
|
||
serverpartModel.MANAGERCOMPANY = drSERVERPART["MANAGERCOMPANY"].ToString(); //管理公司
|
||
serverpartModel.SHORTNAME = drSERVERPART["SHORTNAME"].ToString(); //服务区简称
|
||
if (drSERVERPART["REGIONTYPE_ID"].ToString() != "")
|
||
{
|
||
serverpartModel.REGIONTYPE_ID = drSERVERPART["REGIONTYPE_ID"].TryParseToInt(); //附属管辖内码
|
||
}
|
||
serverpartModel.PROVINCE_NAME = drSERVERPART["PROVINCE_NAME"].ToString(); //省份名称
|
||
serverpartModel.REGIONTYPE_NAME = drSERVERPART["REGIONTYPE_NAME"].ToString(); //附属管辖名称
|
||
if (drSERVERPART["STAFF_ID"].ToString() != "")
|
||
{
|
||
serverpartModel.STAFF_ID = drSERVERPART["STAFF_ID"].TryParseToInt(); //操作员内码
|
||
}
|
||
serverpartModel.STAFF_NAME = drSERVERPART["STAFF_NAME"].ToString(); //操作人员
|
||
if (!string.IsNullOrWhiteSpace(drSERVERPART["OPERATE_DATE"].ToString()))
|
||
{
|
||
//操作时间
|
||
serverpartModel.OPERATE_DATE = drSERVERPART["OPERATE_DATE"].ToString();
|
||
}
|
||
serverpartModel.SERVERPART_DESC = drSERVERPART["SERVERPART_DESC"].ToString(); //备注说明
|
||
}
|
||
#endregion
|
||
|
||
#endregion
|
||
|
||
#region 获取服务区信息表明细
|
||
/// <summary>
|
||
/// 获取服务区信息表明细
|
||
/// </summary>
|
||
/// <param name="transaction">事务管理器</param>
|
||
/// <param name="SERVERPARTId">服务区信息表内码</param>
|
||
public static Model.SERVERPARTModel GetSERVERPARTDetail(Transaction transaction, int SERVERPARTId)
|
||
{
|
||
Model.SERVERPARTModel serverpartModel = new Model.SERVERPARTModel();
|
||
|
||
string WhereSQL = "WHERE SERVERPART_ID = " + SERVERPARTId;
|
||
//查询明细数据
|
||
DataTable dtSERVERPART = new Business.HIGHWAYPROINST(transaction).ExecuteDataTable(
|
||
"SELECT * FROM HIGHWAY_STORAGE.T_SERVERPART " + WhereSQL);
|
||
if (dtSERVERPART.Rows.Count > 0)
|
||
{
|
||
//绑定服务区信息表数据对象
|
||
BindDataRowToModel(dtSERVERPART.Rows[0], serverpartModel);
|
||
}
|
||
|
||
return serverpartModel;
|
||
}
|
||
#endregion
|
||
|
||
#region 同步服务区信息表
|
||
/// <summary>
|
||
/// 赋值服务区信息表数据对象
|
||
/// </summary>
|
||
/// <param name="transaction">事务管理器</param>
|
||
/// <param name="serverpartModel">服务区信息表数据对象</param>
|
||
public static bool SynchroSERVERPART(Transaction transaction, Model.SERVERPARTModel serverpartModel)
|
||
{
|
||
bool SynchroFlag = true;
|
||
|
||
string SQLString;
|
||
List<string> excludeField = new List<string>();
|
||
Dictionary<string, string> dateFieldList = new Dictionary<string, string>();
|
||
string tableName = "HIGHWAY_STORAGE.T_SERVERPART", keyField = "SERVERPART_ID", seqName = "SEQ_SERVERPART";
|
||
Business.HIGHWAYPROINST _HIGHWAYPROINST = new Business.HIGHWAYPROINST(transaction);
|
||
|
||
#region 添加SQL语句中需要排除在外的字段
|
||
excludeField.Add("SERVERPART_IDS");
|
||
excludeField.Add("SERVERPART_CODES");
|
||
excludeField.Add("SPREGIONTYPE_IDS");
|
||
excludeField.Add("OWNERUNIT_IDS");
|
||
#endregion
|
||
|
||
#region 添加SQL语句中日期相关字段的执行语句
|
||
//操作时间
|
||
if (!string.IsNullOrWhiteSpace(serverpartModel.OPERATE_DATE))
|
||
{
|
||
dateFieldList.Add("OPERATE_DATE", "TO_DATE('" +
|
||
serverpartModel.OPERATE_DATE + "','YYYY/MM/DD HH24:MI:SS')");
|
||
}
|
||
else
|
||
{
|
||
dateFieldList.Add("OPERATE_DATE", "NULL");
|
||
}
|
||
#endregion
|
||
|
||
if (serverpartModel.SERVERPART_ID != null)
|
||
{
|
||
string WhereSQL = " WHERE SERVERPART_ID = " + serverpartModel.SERVERPART_ID;
|
||
DataTable dtSERVERPART = _HIGHWAYPROINST.ExecuteDataTable(
|
||
"SELECT * FROM HIGHWAY_STORAGE.T_SERVERPART" + WhereSQL);
|
||
if (dtSERVERPART.Rows.Count > 0)
|
||
{
|
||
SQLString = OperationDataHelper<Model.SERVERPARTModel>.GetTableExcuteSQL(
|
||
serverpartModel, 1, tableName, keyField, seqName, dateFieldList, excludeField, WhereSQL);
|
||
}
|
||
else
|
||
{
|
||
return false;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
DataTable dtSERVERPART = _HIGHWAYPROINST.ExecuteDataTable(
|
||
"SELECT " + seqName + ".NEXTVAL FROM DUAL");
|
||
serverpartModel.SERVERPART_ID = dtSERVERPART.Rows[0][0].TryParseToInt();
|
||
SQLString = OperationDataHelper<Model.SERVERPARTModel>.GetTableExcuteSQL(
|
||
serverpartModel, 0, tableName, keyField, seqName, dateFieldList, excludeField);
|
||
}
|
||
_HIGHWAYPROINST.ExecuteNonQuery(SQLString, null);
|
||
|
||
return SynchroFlag;
|
||
}
|
||
#endregion
|
||
|
||
#region 删除服务区信息表
|
||
/// <summary>
|
||
/// 删除服务区信息表
|
||
/// </summary>
|
||
/// <param name="transaction">事务管理器</param>
|
||
/// <param name="SERVERPARTId">服务区信息表内码</param>
|
||
public static bool DeleteSERVERPART(Transaction transaction, int? SERVERPARTId)
|
||
{
|
||
bool DeleteFlag = false;
|
||
|
||
if (SERVERPARTId != null)
|
||
{
|
||
}
|
||
|
||
return DeleteFlag;
|
||
}
|
||
#endregion
|
||
}
|
||
}
|