ldj/Model/wms/tables/Node.cs

119 lines
2.5 KiB
C#
Raw Normal View History

2023-05-23 16:13:17 +08:00

/// <summary>
///INTERFACE CLASS FOR TABLE t_node
///By wm with codesmith.
///on 04/27/2017
/// </summary>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
2023-11-21 19:18:23 +08:00
using DeiNiu.Utils;
2023-05-23 16:13:17 +08:00
namespace DeiNiu.wms.Data.Model
{
[Serializable]
public class Node : Node_base
{
public Node()
{
}
public Node(int id): base(id)
{
}
public Node(DataRow dr)
: base(dr)
{
}
protected override void getImp()
{
model_imp = new Node_Imp();
}
//begin cust db operation, query, excute sql etc.
public DataSet QueryByName(string name)
{
cmdParameters[0] = name;
return CustQuery(100);
}
public int getCntByName(string name)
{
int cnt = 0;
cmdParameters[0] = name;
DataTable dt = CustQuery(200).Tables[0];
if (dt.Rows.Count > 0 && dt.Columns.Count > 0)
{
cnt = Convert.ToInt32(dt.Rows[0][0].ToString());
};
return cnt;
}
/// <summary>
/// for combox show
/// </summary>
/// <returns></returns>
public override string ToString()
{
return _name;
}
2023-11-21 19:18:23 +08:00
public string ToJsonString()
{
return Util.getJson(this);
}
2023-05-23 16:13:17 +08:00
/// <summary>
/// query dic that has flag
/// used for building combox
/// </summary>
/// <returns></returns>
public DataTable QueryByFlags()
{
return CustQuery(300).Tables[0];
}
/// <summary>
/// query dic that has flag
/// used for building combox
/// </summary>
/// <returns></returns>
public DataTable QueryByFlag(int flag)
{
cmdParameters[0] = flag;
return CustQuery(400).Tables[0];
}
public DataTable queryChildsByFlag(int flag)
{
cmdParameters[0] = flag;
return CustQuery(401).Tables[0];
}
public DataTable QueryByFlags(int[] flags)
{
string tmp = "(";
foreach (int i in flags)
{
tmp += i+",";
}
tmp = tmp.Substring(0, tmp.Length - 1);
tmp += ")";
cmdParameters[0] = tmp;
return CustQuery(500).Tables[0];
}
}
}