You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.9 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using TradeModel;
using TradeData;
namespace TradeManageNew
{
/// <summary>
/// UserServiceNew 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。
[System.Web.Script.Services.ScriptService]
public class UserServiceNew : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
string a = "1";
return "Hello World";
}
[WebMethod(EnableSession = true)]
public bool LoginNew(string UserName, string PassWord, string ul, string LoginIp)
{
int isNB = 0;
if (ul.Contains("192.168."))
{
isNB = 1;
}
JC_UserInfo info = BaseService.LoginNew(UserName, PassWord, LoginIp, isNB);
if (info == null)
{
string logContent = "登陆用户名:" + UserName + "密码:" + PassWord + "登陆时间:" + DateTime.Now.ToString() + "登陆ip" + LoginIp;
return false;
}
UserModel model = new UserModel();
if (info.CompanyId > 0)
{
model.CompanyID = info.CompanyId.Value;
}
model.Name = info.Name;
model.UserID = info.UserId.Value;
model.UserType = info.UserType;
model.UserName = UserName;
model.PassWord = PassWord;
model.CompanyName = info.CompanyName;
if (info.DeptId.HasValue)
{
model.DeptId = info.DeptId.Value;
}
else
{
model.DeptId = 0;
}
model.Duty = info.Duty;
base.Session["CompanyId"] = model.CompanyID;
base.Session["DeptId"] = model.DeptId;
base.Session["Name"] = model.Name;
base.Session["UserId"] = model.UserID;
base.Session["UserName"] = model.UserName;
base.Session["UserType"] = model.UserType;
base.Session["CompanyName"] = model.CompanyName;
base.Session["Duty"] = model.Duty;
base.Session["Login_UserModel"] = model;
return true;
}
#region 读取平台
[WebMethod(EnableSession = true)]
public List<JC_BaseCodeDetail> GetPlatBaseCode(int CompanyID, string KeyName)
{
PagesNew.Login(this.Session);
if (CompanyID == 0) CompanyID = Convert.ToInt32(Session["CompanyId"]);
return BaseService.GetPlatBaseCode(CompanyID, KeyName);
}
#endregion
}
}