109 lines
3.2 KiB
C#
109 lines
3.2 KiB
C#
/// <summary>
|
||
///WCF service
|
||
///FOR TABLE t_online
|
||
///By wm
|
||
///on 06/18/2022
|
||
/// </summary>
|
||
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using DeiNiu.wms.Data.Model.Wcf ;
|
||
using DeiNiu.wms.Data.Model;
|
||
using DeiNiu.Utils;
|
||
using System;
|
||
using DeiNiu.wms.Logical;
|
||
//using DeiNiu.wms.Logical;
|
||
namespace DeiNiu.Wcf
|
||
{
|
||
// 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码、svc 和配置文件中的类名 。
|
||
public class T_ONLINE : IOnline
|
||
{
|
||
#region options
|
||
/*: basicService,
|
||
private static lOnline _lOnline ;
|
||
lOnline lOnlineObj
|
||
{
|
||
get
|
||
{
|
||
if ( _lOnline == null || _lOnline.operId != getOperId())
|
||
{
|
||
_lOnline= new lOnline(getOperId());
|
||
}
|
||
return _lOnline;
|
||
}
|
||
}
|
||
*/
|
||
#endregion
|
||
|
||
|
||
public WcfOnline getObj(int Id)
|
||
{
|
||
LogHelper.debug(typeof(WcfOnline), "收到请求....custId "+ Id);
|
||
Online dbObj = new Online(Id);
|
||
WcfOnline wcfObj = new WcfOnline().getWcfObject(dbObj);
|
||
|
||
|
||
if (string.IsNullOrEmpty(wcfObj.custId ))
|
||
{
|
||
wcfObj.state = (int)enumOnlineStatus.过期;
|
||
wcfObj.custName = "未知";
|
||
wcfObj.msg = "请联系供应商";
|
||
}
|
||
|
||
enumOnlineStatus status = (enumOnlineStatus)wcfObj.state;
|
||
|
||
if (!string.IsNullOrEmpty(wcfObj.custId) && status == enumOnlineStatus.试用)
|
||
{
|
||
DateTime endate = Convert.ToDateTime(wcfObj.endDate);
|
||
int result = DateTime.Compare(DateTime.Now, endate);
|
||
|
||
if (result > 0)
|
||
{
|
||
wcfObj.state = (int)enumOnlineStatus.过期;
|
||
dbObj.state = wcfObj.state;
|
||
dbObj.Update();
|
||
}
|
||
}
|
||
|
||
LogHelper.debug(typeof(WcfOnline), String.Format("custName {0}, status {1}",wcfObj.custName,status));
|
||
return wcfObj ;
|
||
}
|
||
|
||
public int validUser(string userId, string passwd)
|
||
{
|
||
Employee emp = new Employee();
|
||
return emp.ValidUser(userId, passwd);
|
||
}
|
||
|
||
public Dictionary<String, List<String>> getCatedAuths(int userId, int warehouse)
|
||
{
|
||
|
||
Dictionary<String, List<String>> rs = new Dictionary<string, List<string>>();
|
||
Dictionary<String, List<Authority>> auths = new LAuthority().getCatedAuthorities(userId, warehouse);
|
||
foreach (String cate in auths.Keys)
|
||
{
|
||
List<String> lst = new List<string>();
|
||
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 DataTable getDictionary()
|
||
{
|
||
return new DataTable("abc");
|
||
}
|
||
}
|
||
}
|