ldj/WcfService1/NodeService.svc.cs

121 lines
2.9 KiB
C#
Raw Normal View History

2023-05-23 16:13:17 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using DeiNiu.wms.Data.Model;
using System.Data;
using DeiNiu.wms.Logical;
using DeiNiu.Utils;
using WcfServiceAuthentication;
namespace DeiNiu.Wcf
{
// 注意: 使用“重构”菜单上的“重命名”命令可以同时更改代码、svc 和配置文件中的类名“Node”。
public class NodeService : basicService, INode
{
private static lNode _lnode;
lNode lnode
{
get
{
if (_lnode == null || _lnode.operId != getOperId())
{
_lnode = new lNode(getOperId());
}
return _lnode;
}
}
public int newNode(string name,string description,int parentId,int flag)
{
Node node = new Node();
node.flag = flag;
node.parentid = parentId;
node.description = description;
node.name = name;
node.operater = getOperId();
return node.Add();//return pk
}
public wcfNode newWcfNode(wcfNode wnode)
{
Node node = getNode(wnode);
node.Add();
wnode.id = node.ID;
return wnode;
}
public wcfNode updateWcfNode(wcfNode wnode)
{
2023-09-04 22:41:19 +08:00
log.Debug("start ot update node......");
2023-05-23 16:13:17 +08:00
getNode( wnode).Update();
WmsConstants.IS_INITIALED = false; // to update constants
2023-09-04 22:41:19 +08:00
Node nd = new Node(wnode.id);
log.Debug("updated value...." + Util.getJson(nd));
return wnode;
2023-05-23 16:13:17 +08:00
}
Node getNode(wcfNode wnode)
{
2023-09-04 22:41:19 +08:00
Node node = new Node(wnode.id);
2023-05-23 16:13:17 +08:00
node.flag = wnode.flag;
node.parentid = wnode.parentid;
node.description = wnode.description;
node.name = wnode.name;
node.operater = getOperId();
node.ID = wnode.id;
node.value = wnode.value;
node.isOn = wnode.isOn;
node.isSystem = wnode.isSystem;
node.valueType = wnode.valueType;
2023-09-04 22:41:19 +08:00
log.Debug(Util.getJson(node));
2023-05-23 16:13:17 +08:00
return node;
}
public DataSet Query(string querystr, int rownumStart, int rownumEnd)
{
return lnode.Query(querystr, rownumStart, rownumEnd);
}
public int deleteNode(int id)
{
Node node = new Node(id);
return node.Delete();
}
public DataTable getNodesByFlag(int flag)
{
return new Node().QueryByFlag(flag);
}
public void applyDicChanges()
{
WmsConstants.IS_INITIALED = false;
lnode.initialConstants();
}
public DataTable getOwners()
{
Owner owner = new Owner();
return owner.getActiveOwners();
}
}
}