You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
90 lines
2.2 KiB
90 lines
2.2 KiB
using OT.COM.LogisticsUtil;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace OT.COM.ArsenalDB
|
|
{
|
|
public class QueryJson
|
|
{
|
|
public List<QueryJsonElement> AllBlocks { get; set; }
|
|
|
|
public QueryJson()
|
|
{
|
|
this.AllBlocks = new List<QueryJsonElement>();
|
|
}
|
|
|
|
public string AddBlock(params QueryJsonElement[] i_aqje)
|
|
{
|
|
string sMsg = null;
|
|
|
|
try
|
|
{
|
|
do
|
|
{
|
|
for (int i = 0; i < i_aqje.Length; i++)
|
|
{
|
|
QueryJsonElement qje = i_aqje[i];
|
|
if (qje.tablealias == null)
|
|
{
|
|
sMsg = "NO TABLE ALIAS";
|
|
break;
|
|
}
|
|
|
|
|
|
|
|
if (this.AllBlocks.FirstOrDefault(f => f.tablealias == qje.tablealias) != null)
|
|
{
|
|
sMsg = "DUPLICATE TABLE ALIAS";
|
|
break;
|
|
}
|
|
|
|
if (qje.table == null)
|
|
{
|
|
sMsg = "NO TABLE NAME";
|
|
break;
|
|
}
|
|
|
|
this.AllBlocks.Add( qje);
|
|
}
|
|
}
|
|
while (false);
|
|
}
|
|
catch(Exception e)
|
|
{
|
|
sMsg = new Util().GetLastExceptionMsg(e);
|
|
}
|
|
return sMsg;
|
|
}
|
|
|
|
public string MakeCommand(TableInfo i_dbt, out Command o_cCmd)
|
|
{
|
|
string sMsg = null;
|
|
Command cTemp = null;
|
|
|
|
try
|
|
{
|
|
do
|
|
{
|
|
if(this.AllBlocks.Count() == 0)
|
|
{
|
|
sMsg = "NO TABLE";
|
|
break;
|
|
}
|
|
|
|
cTemp = Command.SetupJoinQuery(i_dbt, this.AllBlocks);
|
|
|
|
}
|
|
while (false);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
sMsg = new Util().GetLastExceptionMsg(e);
|
|
}
|
|
|
|
o_cCmd = cTemp;
|
|
return sMsg;
|
|
}
|
|
}
|
|
}
|