|
@ -19,6 +19,7 @@ using CK.SCP.Models.Enums; |
|
|
using System.Drawing; |
|
|
using System.Drawing; |
|
|
using static CK.SCP.Common.MyWebSmtpMail; |
|
|
using static CK.SCP.Common.MyWebSmtpMail; |
|
|
using MailKit.Security; |
|
|
using MailKit.Security; |
|
|
|
|
|
using System.Collections; |
|
|
|
|
|
|
|
|
namespace SCP |
|
|
namespace SCP |
|
|
{ |
|
|
{ |
|
@ -48,7 +49,10 @@ namespace SCP |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
User user = DB.Users.Where(u => u.Name == _name && u.Email == _mail).FirstOrDefault(); |
|
|
User user = DB.Users.Where(u => u.Name == _name && u.Email == _mail).FirstOrDefault(); |
|
|
user.UsedDomain = factoryValue.Value; |
|
|
var _list = SCPDB.TB_FACTORY.ToList(); |
|
|
|
|
|
var erpdomain = _list.FirstOrDefault(q => q.ErpSite == factoryValue.Value).ErpDomain; |
|
|
|
|
|
user.UsedDomain = erpdomain; |
|
|
|
|
|
user.UserdSite = factoryValue.Value; |
|
|
if (user != null) |
|
|
if (user != null) |
|
|
{ |
|
|
{ |
|
|
if (!user.Enabled) |
|
|
if (!user.Enabled) |
|
@ -87,7 +91,7 @@ namespace SCP |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
factory.DataTextField = "FactoryName"; |
|
|
factory.DataTextField = "FactoryName"; |
|
|
factory.DataValueField = "ErpDomain"; |
|
|
factory.DataValueField = "ErpSite"; |
|
|
factory.DataSource = _list; |
|
|
factory.DataSource = _list; |
|
|
factory.DataBind(); |
|
|
factory.DataBind(); |
|
|
|
|
|
|
|
@ -119,6 +123,7 @@ namespace SCP |
|
|
} |
|
|
} |
|
|
private void Login(string p_userName, string p_password) |
|
|
private void Login(string p_userName, string p_password) |
|
|
{ |
|
|
{ |
|
|
|
|
|
var _list = SCPDB.TB_FACTORY.ToList(); |
|
|
if (string.IsNullOrEmpty(textUserName.Value) || string.IsNullOrEmpty(textPassword.Value)) |
|
|
if (string.IsNullOrEmpty(textUserName.Value) || string.IsNullOrEmpty(textPassword.Value)) |
|
|
{ |
|
|
{ |
|
|
Alert.Show(GetResourceKey("用户名或密码不能为空!")); |
|
|
Alert.Show(GetResourceKey("用户名或密码不能为空!")); |
|
@ -190,8 +195,15 @@ namespace SCP |
|
|
} |
|
|
} |
|
|
var _factoryList = DB.Users.Where(itm => itm.Name == user.Name).FirstOrDefault().TA_FACTORY.Select(p => p.FactoryId).ToList(); |
|
|
var _factoryList = DB.Users.Where(itm => itm.Name == user.Name).FirstOrDefault().TA_FACTORY.Select(p => p.FactoryId).ToList(); |
|
|
var fac = DB.TA_FACTORY.Select(p => p.FactoryId).ToList(); |
|
|
var fac = DB.TA_FACTORY.Select(p => p.FactoryId).ToList(); |
|
|
user.UsedDomain = factoryValue.Value; |
|
|
if (string.IsNullOrEmpty( factoryValue.Value)) |
|
|
if (_factoryList.Contains(factoryValue.Value)) |
|
|
{ |
|
|
|
|
|
factoryValue.Value = SCPDB.TB_FACTORY.ToList().FirstOrDefault().ErpSite; |
|
|
|
|
|
} |
|
|
|
|
|
var erpdomain = _list.FirstOrDefault(q => q.ErpSite == factoryValue.Value).ErpDomain; |
|
|
|
|
|
user.UsedDomain = erpdomain; |
|
|
|
|
|
user.UserdSite = factoryValue.Value; |
|
|
|
|
|
|
|
|
|
|
|
if (_factoryList.Contains(erpdomain)) |
|
|
{ |
|
|
{ |
|
|
string date = DateTime.Now.ToShortDateString(); |
|
|
string date = DateTime.Now.ToShortDateString(); |
|
|
var ret = SCP_LOGINNUMBER_CONTROLLER.Save_TA_LOGINNUMBER(p_userName, LoginNumer.Sussess, date); |
|
|
var ret = SCP_LOGINNUMBER_CONTROLLER.Save_TA_LOGINNUMBER(p_userName, LoginNumer.Sussess, date); |
|
@ -296,6 +308,7 @@ namespace SCP |
|
|
if (first != null) |
|
|
if (first != null) |
|
|
{ |
|
|
{ |
|
|
first.Remark = user.UsedDomain; |
|
|
first.Remark = user.UsedDomain; |
|
|
|
|
|
first.UserdSite = user.UserdSite; |
|
|
DB.SaveChanges(); |
|
|
DB.SaveChanges(); |
|
|
} |
|
|
} |
|
|
img.ImageUrl = DrawToBase64(4); |
|
|
img.ImageUrl = DrawToBase64(4); |
|
|