ldj/WcfService1/NodeService.svc.cs

127 lines
3.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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;
protected static log4net.ILog logNode = log4net.LogManager.GetLogger("node");
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)
{
logNode.Debug("operId is " + getOperId());
logNode.Debug("before update node......" + new Node(wnode.id).ToJsonString());
Node nd = getNode(wnode);
logNode.Debug("start update node......" + nd.ToJsonString());
nd.operater = getOperId();
nd .Update();
WmsConstants.IS_INITIALED = false; // to update constants
nd = new Node(wnode.id);
logNode.Debug("updated value...." +nd.ToJsonString());
return wnode;
}
Node getNode(wcfNode wnode)
{
Node node = new Node(wnode.id);
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;
// log.Debug(Util.getJson(node));
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();
}
}
}