diff --git a/SCP/Default1.aspx b/SCP/Default1.aspx index 36d09c2..6f24b76 100644 --- a/SCP/Default1.aspx +++ b/SCP/Default1.aspx @@ -1,61 +1,161 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default1.aspx.cs" Inherits="SCP.Default1" %> +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default1.aspx.cs" Inherits="SCP.Default1" ValidateRequest="true" %> - + - - - - + + SCP供应商协同管理系统 + -
- - + +
+ + + + +
+ + + +
 
+ + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +<%-- --%> +<%-- --%> +<%-- --%> +<%-- --%> + + + + + + + +
+
+
+
+ + +
+
+
+ + + + + + +

<%= GetResourceKey("适用浏览器:360、FireFox、搜狗、谷歌等. 不支持IE10及以下浏览器") %>。

+
+
+ <%= GetResourceKey("供应商请先安装报表插件下载") %>
+ + + + + diff --git a/SCP/Default1.aspx.cs b/SCP/Default1.aspx.cs index cdad6a4..812bdde 100644 --- a/SCP/Default1.aspx.cs +++ b/SCP/Default1.aspx.cs @@ -5,13 +5,228 @@ using System.Web; using System.Web.UI; using System.Web.UI.WebControls; + +using System.Data; + +using System.Web.Security; +using FineUI; +using System.Text; + +using CK.SCP.Models.AppBoxEntity; + +using CK.SCP.Models.ScpEntity; +using CK.SCP.Controller; +using System.Text.RegularExpressions; +using CK.SCP.Models; +using CK.SCP.Utils; +using CK.SCP.Common; +using System.Configuration; +using SCP.Code; + + + namespace SCP { public partial class Default1 : PageBase { protected void Page_Load(object sender, EventArgs e) { + if (!IsPostBack) + { + GetFactoryName(); + var _username = Request.QueryString["t"]; + var _email = Request.QueryString["u"]; + if (string.IsNullOrEmpty(_username) && string.IsNullOrEmpty(_email)) + { + LoadData(); + } + else + { + if (!string.IsNullOrEmpty(_username) && !string.IsNullOrEmpty(_email)) + { + var _name = Encryption64.Decrypt(_username, DateTime.Now.ToString("yyyyMMdd")); + var _mail = Encryption64.Decrypt(_email, DateTime.Now.ToString("yyyyMMdd")); + if (string.IsNullOrEmpty(_name) || string.IsNullOrEmpty(_mail)) + { + LoadData(); + } + else + { + User user = DB.Users.Where(u => u.Name == _name && u.Email == _mail).FirstOrDefault(); + user.UsedDomain = factoryValue.Value; + if (user != null) + { + if (!user.Enabled) + { + Alert.Show(GetResourceKey("用户未启用,请联系管理员!")); + } + else + { + LoginSuccess(user); + } + } + } + } + } + } + + } + private void LoadData() + { + // 如果用户已经登录,则重定向到管理首页 + if (User.Identity.IsAuthenticated) + { + Response.Redirect(FormsAuthentication.DefaultUrl); + } + } + protected string GetFactoryName() + { + + + var _list = SCPDB.TB_FACTORY.ToList(); + //dp_List.DataTextField = "FactoryName"; + //dp_List.DataValueField= "ErpDomain"; + //dp_List.DataSource =_list; + //dp_List.DataBind(); + + + factory.DataTextField = "FactoryName"; + factory.DataValueField = "ErpDomain"; + factory.DataSource = _list; + factory.DataBind(); + + string _content = "闻荫科技有限公司"; + TA_CONFIG _cf = SCPDB.TA_CONFIG.FirstOrDefault(p => p.ParamName == ("工厂名称")); + if (_cf != null) + { + _content = _cf.ParamValue; + } + return _content; + } + protected void ImageButton1_Click(object sender, ImageClickEventArgs e) + { + //用户登录 + try + { + + string userName = txtUserName.Text.Trim(); + string password = txtPassword.Text.Trim(); + LoadResouce(); + Login(userName, password); + + } + catch (Exception ex) + { + + } + } + private void Login(string p_userName, string p_password) + { + if (string.IsNullOrEmpty(txtUserName.Text) || string.IsNullOrEmpty(txtPassword.Text)) + { + Alert.Show(GetResourceKey("用户名或密码不能为空!")); + return; + } + User user = DB.Users.Where(u => u.Name == p_userName).FirstOrDefault(); + + if (user != null) + { + if (PasswordUtil.ComparePasswords(user.Password, p_password)) + { + + if (!user.Enabled) + { + Alert.Show(GetResourceKey("用户未启用,请联系管理员!")); + } + else + { + + var _factoryList = DB.Users.Where(itm => itm.Name == user.Name).FirstOrDefault().TA_FACTORY.Select(p => p.FactoryId).ToList(); + user.UsedDomain = factoryValue.Value; + if (_factoryList.Contains(factoryValue.Value)) + { + // 登录成功 + LoginSuccess(user); + } + else + { + Alert.Show("不选定工厂下供应商"); + return; + } + return; + } + } + else + { + Alert.Show(GetResourceKey("用户名或密码错误!")); + return; + } + } + else + { + Alert.Show(GetResourceKey("用户名或密码错误!")); + return; + } + } + //获取登录的用户信息 + public static UserLoginInfo UserInfo + { + get + { + if (HttpContext.Current.Session["user"] != null) + { + return (UserLoginInfo)HttpContext.Current.Session["user"]; + } + return null; + } + } + + + + private void LoginSuccess(User user) + { + + RegisterOnlineUser(user); + // 用户所属的角色字符串,以逗号分隔 + string roleIDs = String.Empty; + if (user.Roles != null) + { + roleIDs = String.Join(",", user.Roles.Select(r => r.ID).ToArray()); + } + bool isPersistent = true; + DateTime expiration = DateTime.Now.AddMinutes(double.Parse(ConfigurationManager.AppSettings["SCP_TIME_OUT"])); + CreateFormsAuthenticationTicket(user.Name, roleIDs, isPersistent, expiration, user.UsedDomain); + + var first = DB.Users.Where(p => p.Name == user.Name).FirstOrDefault(); + if (first != null) + { + first.Remark = user.UsedDomain; + DB.SaveChanges(); + } + + // 重定向到登陆后首页 + Response.Redirect(FormsAuthentication.DefaultUrl); + } + private void LoadResouce() + { + List _list = new List(); + Application["LanguageList"] = ScpCache.LangauageList; + } + + + public class UserLoginInfo + { + public int UserID; + public string UserType; + public string UserName; + public string SupplierCode; + public string SupplierName; + public string FactoryCode; + public string FactoryName; + public string Authority; + public DataTable AuthorityData = null; + public bool LookPrice; } } } \ No newline at end of file diff --git a/SCP/Default1.aspx.designer.cs b/SCP/Default1.aspx.designer.cs index 4c9903d..5951a79 100644 --- a/SCP/Default1.aspx.designer.cs +++ b/SCP/Default1.aspx.designer.cs @@ -7,11 +7,22 @@ // //------------------------------------------------------------------------------ -namespace SCP { - - - public partial class Default1 { - +namespace SCP +{ + + + public partial class Default1 + { + + /// + /// Head1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlHead Head1; + /// /// form1 控件。 /// @@ -20,77 +31,86 @@ namespace SCP { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::System.Web.UI.HtmlControls.HtmlForm form1; - + /// - /// PageManager1 控件。 + /// factory 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUI.PageManager PageManager1; - + protected global::System.Web.UI.HtmlControls.HtmlSelect factory; + /// - /// Window1 控件。 + /// txtUserName 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUI.Window Window1; - + protected global::System.Web.UI.WebControls.TextBox txtUserName; + /// - /// imageLogin 控件。 + /// txtPassword 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUI.Image imageLogin; - + protected global::System.Web.UI.WebControls.TextBox txtPassword; + + /// + /// ImageButton1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.ImageButton ImageButton1; + /// - /// SimpleForm1 控件。 + /// Label1 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUI.SimpleForm SimpleForm1; - + protected global::System.Web.UI.WebControls.Label Label1; + /// - /// tbxUserName 控件。 + /// Label2 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUI.TextBox tbxUserName; - + protected global::System.Web.UI.WebControls.Label Label2; + /// - /// tbxPassword 控件。 + /// factoryValue 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUI.TextBox tbxPassword; - + protected global::System.Web.UI.WebControls.HiddenField factoryValue; + /// - /// DDL_LANGUAGE 控件。 + /// p1 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUI.DropDownList DDL_LANGUAGE; - + protected global::System.Web.UI.HtmlControls.HtmlGenericControl p1; + /// - /// btnSubmit 控件。 + /// A1 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUI.Button btnSubmit; + protected global::System.Web.UI.HtmlControls.HtmlAnchor A1; } } diff --git a/SCP/SCP.csproj b/SCP/SCP.csproj index d3441db..5499da4 100644 --- a/SCP/SCP.csproj +++ b/SCP/SCP.csproj @@ -215,10 +215,20 @@ + + + + + + + + + + @@ -2915,6 +2925,8 @@ + + @@ -6465,6 +6477,8 @@ 62030 / http://localhost:5678 + True + http://localhost:5678/ False False diff --git a/SCP/Web.config b/SCP/Web.config index 562fb79..4b2f69c 100644 --- a/SCP/Web.config +++ b/SCP/Web.config @@ -80,7 +80,7 @@ minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" enableVersionHeader="false"/> - + @@ -156,6 +156,17 @@ minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" ena + + + + + + + + + + + diff --git a/SCP/default.aspx b/SCP/default.aspx index 669c98e..7ebb8c2 100644 --- a/SCP/default.aspx +++ b/SCP/default.aspx @@ -32,7 +32,7 @@ --%>
- + diff --git a/SCP/res/images/20210302140650.png b/SCP/res/images/20210302140650.png new file mode 100644 index 0000000..a783a90 Binary files /dev/null and b/SCP/res/images/20210302140650.png differ diff --git a/SCP/res/images/btnLogin.jpg b/SCP/res/images/btnLogin.jpg new file mode 100644 index 0000000..4d6691d Binary files /dev/null and b/SCP/res/images/btnLogin.jpg differ diff --git a/SCP/res/images/collapse-all.gif b/SCP/res/images/collapse-all.gif new file mode 100644 index 0000000..891d1b7 Binary files /dev/null and b/SCP/res/images/collapse-all.gif differ diff --git a/SCP/res/images/expand-all.gif b/SCP/res/images/expand-all.gif new file mode 100644 index 0000000..3798498 Binary files /dev/null and b/SCP/res/images/expand-all.gif differ diff --git a/SCP/res/images/login_bg.jpg b/SCP/res/images/login_bg.jpg new file mode 100644 index 0000000..25d66e2 Binary files /dev/null and b/SCP/res/images/login_bg.jpg differ diff --git a/SCP/res/images/login_bg_1.jpg b/SCP/res/images/login_bg_1.jpg new file mode 100644 index 0000000..37bc350 Binary files /dev/null and b/SCP/res/images/login_bg_1.jpg differ diff --git a/SCP/res/images/login_content.jpg b/SCP/res/images/login_content.jpg new file mode 100644 index 0000000..df7a1cc Binary files /dev/null and b/SCP/res/images/login_content.jpg differ diff --git a/SCP/res/images/login_form.jpg b/SCP/res/images/login_form.jpg new file mode 100644 index 0000000..d28d4cf Binary files /dev/null and b/SCP/res/images/login_form.jpg differ diff --git a/SCP/res/images/login_title - 副本.psd b/SCP/res/images/login_title - 副本.psd new file mode 100644 index 0000000..6cda7f5 Binary files /dev/null and b/SCP/res/images/login_title - 副本.psd differ diff --git a/SCP/res/images/login_title.jpg b/SCP/res/images/login_title.jpg new file mode 100644 index 0000000..9dfd04b Binary files /dev/null and b/SCP/res/images/login_title.jpg differ diff --git a/SCP/res/images/login_title.psd b/SCP/res/images/login_title.psd new file mode 100644 index 0000000..12775fc Binary files /dev/null and b/SCP/res/images/login_title.psd differ diff --git a/SCP/res/images/logo.gif b/SCP/res/images/logo.gif new file mode 100644 index 0000000..7b3c2ef Binary files /dev/null and b/SCP/res/images/logo.gif differ diff --git a/SCP/res/images/logo.png b/SCP/res/images/logo.png new file mode 100644 index 0000000..a783a90 Binary files /dev/null and b/SCP/res/images/logo.png differ diff --git a/SCP/res/images/new.gif b/SCP/res/images/new.gif new file mode 100644 index 0000000..009c2ea Binary files /dev/null and b/SCP/res/images/new.gif differ