using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.ServiceModel; using System.Text; using DeiNiu.Utils; using System.Configuration; using DeiNiu.wms.Logical; using WcfServiceAuthentication; using System.Threading; using System.Data; using DeiNiu.wms.Data.Model; using System.Management; namespace DeiNiu.Wcf { // 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码、svc 和配置文件中的类名“Setup”。 public class PortalService : IPortal { public int validUser(string userId, string passwd) { Employee emp = new Employee(); return emp.ValidUser(userId, passwd); } public Dictionary> getCatedAuths(int userId ,int warehouse) { Dictionary> rs = new Dictionary>(); Dictionary> auths = new LAuthority().getCatedAuthorities(userId, warehouse); foreach (String cate in auths.Keys) { List lst = new List(); foreach (Authority link in auths[cate]) { if (string.IsNullOrEmpty(link.auth_class)) { continue; } lst.Add(link.auth_name +":"+ link.auth_class); } rs[cate] = lst; } return rs; } public List getSpecialAuths(int userId,int warehouse) { List lst = new List(); Dictionary> auths = new LAuthority().getCatedAuthorities(userId, warehouse); foreach (String cate in auths.Keys) { foreach (Authority link in auths[cate]) { if ( link.auth_special) { lst.Add(link.auth_name); } } } return lst; } public bool haveSpecialAuth(string userId, string passwd, string spAuth) { int eid = validUser(userId, passwd); if (eid > 0) { return getSpecialAuths(eid,-1).Contains(spAuth); } return false; } /* public DataTable getDictionary() { return new lNode().QueryByFlags(); } */ public void updateUserTheme(int userId, string theme) { Employee lem = new Employee(userId); lem.em_profile = theme.Trim(); lem.Update(); } static List warehousenames ; public List getWareHouses(string mgrAddress) { //if (warehousenames == null || warehousenames.Count==0) { warehousenames = new List(); DataTable dt = new LDepartment().getWareHouse(mgrAddress); foreach (DataRow dr in dt.Rows) { warehousenames.Add(dr["dep_name"].ToString() + WmsConstants.SPLIT + dr["id"].ToString() + ":" + dr["svrAdress"].ToString()); } } return warehousenames; } /* static List warehouseMgrs; public List getWareHouseMgrs() { if (warehouseMgrs == null) { warehouseMgrs = new List(); DataTable dt = new LDepartment().getWareHouseMrgDept(); foreach (DataRow dr in dt.Rows) { warehouseMgrs.Add(dr["dep_name"].ToString() + WmsConstants.SPLIT + dr["id"].ToString()); } } return warehouseMgrs; } */ } }