You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
4.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Collections;
using DbCommon;
using System.Data;
using ApServerProvider;
using Estsh.Web.Util;
using System.Text;
namespace Estsh.Core.Repositories
{
public class SeatAliveTimeSpanDal : BaseApp
{
private string[] seatTypeNames = new string[] { "前排", "后坐垫", "后靠背", "后排", "正驾", "副驾", "全部" };
private string[] seatTypeCodes = new string[] { "FRONTROW", "BACKSEAT", "BACKREST", "BACKROW", "DRIVER", "CoDRIVER", "ALLSEAT" };
private string[] gapTypeNames = new string[] { "年", "月", "周", "日", "时", "分", "秒", "毫秒" };
private string[] gapTypeCodes = new string[] { "DYY", "DMM", "WEK", "DDD", "THH", "TMM", "TSS", "TMS" };
public SeatAliveTimeSpanDal(RemotingProxy remotingProxy)
: base(remotingProxy)
{ }
public Hashtable GetSeatType()
{
lock (_remotingProxy)
{
Hashtable resault = new Hashtable();
ArrayList arr = new ArrayList();
for (int i = 0; i < seatTypeNames.Length; i++)
{
Hashtable record = new Hashtable();
record.Add("key", seatTypeNames[i]);
record.Add("value", seatTypeCodes[i]);
arr.Add(record);
}
resault.Add("data", arr);
return resault;
}
}
public Hashtable GetTimeSpanType()
{
lock (_remotingProxy)
{
Hashtable resault = new Hashtable();
ArrayList arr = new ArrayList();
for (int i = 0; i < gapTypeNames.Length; i++)
{
Hashtable record = new Hashtable();
record.Add("key", gapTypeNames[i]);
record.Add("value", gapTypeCodes[i]);
arr.Add(record);
}
resault.Add("data", arr);
return resault;
}
}
public DataTable GetAliveTimeInfo(
string startTime,
string endTime,
string startSN,
string endSN,
string seatType,
string subSeatTye,
string gapType,
string sortType,
int topN
)
{
lock (_remotingProxy)
{
Hashtable ht = new Hashtable(); //ZYxxxxNyymdxxxx //sn style
List<StoreProcedureParameter> Parameters = new List<StoreProcedureParameter>();
Parameters.Add(new StoreProcedureParameter(DbType.String, ParameterDirection.Input, "@startTime", startTime));
Parameters.Add(new StoreProcedureParameter(DbType.String, ParameterDirection.Input, "@endTime", endTime));
Parameters.Add(new StoreProcedureParameter(DbType.String, ParameterDirection.Input, "@startSN", startSN));
Parameters.Add(new StoreProcedureParameter(DbType.String, ParameterDirection.Input, "@endSN", endSN));
Parameters.Add(new StoreProcedureParameter(DbType.String, ParameterDirection.Input, "@seatType", seatType));
Parameters.Add(new StoreProcedureParameter(DbType.String, ParameterDirection.Input, "@subSeatType", subSeatTye));
Parameters.Add(new StoreProcedureParameter(DbType.String, ParameterDirection.Input, "@gapType", gapType));
Parameters.Add(new StoreProcedureParameter(DbType.String, ParameterDirection.Input, "@sortType", sortType));
Parameters.Add(new StoreProcedureParameter(DbType.Int32, ParameterDirection.Input, "@topN", topN));
Parameters.Add(new StoreProcedureParameter(DbType.String, ParameterDirection.Output, "@retCode", 10));
Parameters.Add(new StoreProcedureParameter(DbType.String, ParameterDirection.Output, "@retMsg", 512));
DataTable tmpDT = null;
try
{
tmpDT = _remotingProxy.ExecuteSotreProcedure("spSNInAndOutTimeSpan", Parameters, ref ht);
}
catch (System.Exception ex)
{
return null;
}
if (!ht.Contains("@retCode"))
{
return null;
}
if (ht["@retCode"].ToString().ToUpper() == "PASSED")
{
//Hashtable resault = new Hashtable();
//resault.Add("data", DataTypeConvert.NewObject.DataTableToArrayList(tmpDT));
return tmpDT;
}
else
return null;
}
}
}
}