学 赵
4 years ago
5 changed files with 0 additions and 329 deletions
@ -1,37 +0,0 @@ |
|||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MakeInitUser.aspx.cs" Inherits="SCP.Admin.MakeInitUser" %> |
|||
|
|||
<!DOCTYPE html> |
|||
|
|||
<html xmlns="http://www.w3.org/1999/xhtml"> |
|||
<head runat="server"> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
|||
<title></title> |
|||
</head> |
|||
<body> |
|||
<form id="form1" runat="server"> |
|||
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" /> |
|||
<f:Panel ID="Panel1" runat="server" BodyPadding="5px" |
|||
ShowBorder="false" Layout="VBox" BoxConfigAlign="Stretch" BoxConfigPosition="Start" |
|||
ShowHeader="false" Title="用户管理"> |
|||
<Items> |
|||
<f:Form ID="Form2" runat="server" Height="36px" BodyPadding="5px" ShowHeader="false" |
|||
ShowBorder="false" LabelAlign="Right"> |
|||
<Rows> |
|||
<f:FormRow ID="FormRow1" runat="server"> |
|||
<Items> |
|||
<f:Button Text="生成供应商用户" runat="server" ID="BTN_Make" OnClick="BTN_Make_Click"></f:Button> |
|||
<f:Button Text="生成供应商生成对应关系" runat="server" ID="Button2" OnClick="Button2_Click"></f:Button> |
|||
<f:Button Text="生成供应商相关对应地点" runat="server" ID="Button1" OnClick="Button1_Click"></f:Button> |
|||
</Items> |
|||
</f:FormRow> |
|||
</Rows> |
|||
</f:Form> |
|||
</Items> |
|||
</f:Panel> |
|||
<f:Window ID="Window1" runat="server" IsModal="true" Hidden="true" Target="Top" EnableResize="true" |
|||
EnableMaximize="true" EnableIFrame="true" IFrameUrl="about:blank" Width="800px" |
|||
Height="500px" > |
|||
</f:Window> |
|||
</form> |
|||
</body> |
|||
</html> |
@ -1,161 +0,0 @@ |
|||
using CK.SCP.Models.AppBoxEntity; |
|||
using CK.SCP.Models.AppBoxEntity.ExcelImportEntity; |
|||
using CK.SCP.Utils; |
|||
using FineUI; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Data; |
|||
using System.IO; |
|||
using System.Linq; |
|||
using System.Web; |
|||
using System.Web.UI; |
|||
using System.Web.UI.WebControls; |
|||
|
|||
namespace SCP.Admin |
|||
{ |
|||
public partial class MakeInitUser : PageBase |
|||
{ |
|||
protected void Page_Load(object sender, EventArgs e) |
|||
{ |
|||
|
|||
} |
|||
|
|||
protected void BTN_Make_Click(object sender, EventArgs e) |
|||
{ |
|||
try |
|||
{ |
|||
var vendList = SCPDB.TA_VENDER.ToList(); |
|||
List<APPBOX_USER_EXCEL> list = new List<APPBOX_USER_EXCEL>(); |
|||
foreach (var itm in vendList) |
|||
{ |
|||
APPBOX_USER_EXCEL excel = new APPBOX_USER_EXCEL(); |
|||
excel.登录名称 = itm.VendId; |
|||
excel.密码 = "666666"; |
|||
excel.性别 = "男"; |
|||
excel.姓名 = itm.VendName; |
|||
excel.电子邮件 = itm.VendId + "@163.com"; |
|||
excel.供应商编号 = itm.VendId; |
|||
excel.所属地点 = itm.Site; |
|||
list.Add(excel); |
|||
} |
|||
List<User> _ls = new List<CK.SCP.Models.AppBoxEntity.User>(); |
|||
list.ForEach(itm => |
|||
{ |
|||
var userList = DB.Users.Where(p => p.Name == itm.登录名称).ToList(); |
|||
if(userList.Count==0) |
|||
{ |
|||
User item = new User(); |
|||
item.Name = itm.登录名称 + "@" + itm.所属地点; |
|||
item.Password = PasswordUtil.CreateDbPassword(itm.密码.Trim()); |
|||
item.ChineseName = itm.姓名.Trim(); |
|||
item.Gender = itm.性别; |
|||
item.CompanyEmail = itm.电子邮件.Trim(); |
|||
item.Email = itm.电子邮件.Trim(); |
|||
item.Remark = itm.所属地点; |
|||
item.Enabled = true; |
|||
item.CreateTime = DateTime.Now; |
|||
item.SupplierCode = itm.供应商编号; |
|||
if (!string.IsNullOrEmpty(itm.供应商编号)) |
|||
{ |
|||
var _role = DB.Roles.Where(p => p.Name == "供应商").FirstOrDefault(); |
|||
if (_role != null) |
|||
{ |
|||
item.Roles = new List<Role>(); |
|||
int[] roleIDs = new int[] { _role.ID }; |
|||
|
|||
AddEntities<Role>(item.Roles, roleIDs); |
|||
} |
|||
item.SupplierCode = itm.供应商编号; |
|||
} |
|||
DB.Users.Add(item); |
|||
} |
|||
|
|||
|
|||
}); |
|||
if (DB.SaveChanges() != -1) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
Alert.Show(ex.Message); |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
protected void BTN_Rel_Click(object sender, EventArgs e) |
|||
{ |
|||
|
|||
} |
|||
|
|||
protected void Button1_Click(object sender, EventArgs e) |
|||
{ |
|||
try |
|||
{ |
|||
|
|||
var _userlist = DB.Users.ToList(); |
|||
foreach (var itm in _userlist) |
|||
{ |
|||
if (!string.IsNullOrEmpty(itm.Remark)) |
|||
{ |
|||
var _factory = itm.Remark; |
|||
var _f = DB.TA_FACTORY.Where(p => p.FactoryId == _factory).FirstOrDefault(); |
|||
int[] titleIDs = new int[] { _f.ID }; |
|||
|
|||
AddEntities<TA_FACTORY>(itm.TA_FACTORY, titleIDs); |
|||
|
|||
} |
|||
|
|||
|
|||
} |
|||
DB.SaveChanges(); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
Alert.Show(ex.Message); |
|||
return; |
|||
} |
|||
} |
|||
|
|||
protected void Button2_Click(object sender, EventArgs e) |
|||
{ |
|||
try |
|||
{ |
|||
var _userlist = DB.Users.ToList(); |
|||
foreach (var itm in _userlist) |
|||
{ |
|||
if (!string.IsNullOrEmpty(itm.Remark)) |
|||
{ |
|||
|
|||
|
|||
var _VenderUsers = DB.VenderUsers.Where(p => p.UserId == itm.ID).ToList(); |
|||
if (_VenderUsers != null && _VenderUsers.Count > 0) |
|||
{ |
|||
DB.VenderUsers.RemoveRange(_VenderUsers); |
|||
} |
|||
List<VenderUsers> _vList = new List<VenderUsers>(); |
|||
VenderUsers _vus = new VenderUsers(); |
|||
_vus.UserId = itm.ID; |
|||
_vus.VenderId = itm.Name.Split('@')[0]; |
|||
_vList.Add(_vus); |
|||
if (_vList.Count > 0) |
|||
{ |
|||
var ls = _vList.Where(p => p.UserId > 0 && !string.IsNullOrEmpty(p.VenderId)); |
|||
DB.VenderUsers.AddRange(ls.ToArray()); |
|||
} |
|||
} |
|||
|
|||
} |
|||
DB.SaveChanges(); |
|||
|
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
Alert.Show(ex.Message); |
|||
return; |
|||
} |
|||
} |
|||
} |
|||
} |
@ -1,96 +0,0 @@ |
|||
//------------------------------------------------------------------------------
|
|||
// <自动生成>
|
|||
// 此代码由工具生成。
|
|||
//
|
|||
// 对此文件的更改可能导致不正确的行为,如果
|
|||
// 重新生成代码,则所做更改将丢失。
|
|||
// </自动生成>
|
|||
//------------------------------------------------------------------------------
|
|||
|
|||
namespace SCP.Admin { |
|||
|
|||
|
|||
public partial class MakeInitUser { |
|||
|
|||
/// <summary>
|
|||
/// form1 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::System.Web.UI.HtmlControls.HtmlForm form1; |
|||
|
|||
/// <summary>
|
|||
/// PageManager1 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::FineUI.PageManager PageManager1; |
|||
|
|||
/// <summary>
|
|||
/// Panel1 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::FineUI.Panel Panel1; |
|||
|
|||
/// <summary>
|
|||
/// Form2 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::FineUI.Form Form2; |
|||
|
|||
/// <summary>
|
|||
/// FormRow1 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::FineUI.FormRow FormRow1; |
|||
|
|||
/// <summary>
|
|||
/// BTN_Make 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::FineUI.Button BTN_Make; |
|||
|
|||
/// <summary>
|
|||
/// Button2 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::FineUI.Button Button2; |
|||
|
|||
/// <summary>
|
|||
/// Button1 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::FineUI.Button Button1; |
|||
|
|||
/// <summary>
|
|||
/// Window1 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::FineUI.Window Window1; |
|||
} |
|||
} |
@ -1 +0,0 @@ |
|||
<%@ WebHandler Language="C#" CodeBehind="ServiceHandler.ashx.cs" Class="SCP.Handlers.ServiceHandler" %> |
@ -1,34 +0,0 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Web; |
|||
|
|||
namespace SCP.Handlers |
|||
{ |
|||
/// <summary>
|
|||
/// ServiceHandler 的摘要说明
|
|||
/// </summary>
|
|||
public class ServiceHandler : IHttpHandler |
|||
{ |
|||
|
|||
public void ProcessRequest(HttpContext context) |
|||
{ |
|||
|
|||
|
|||
context.Response.ContentType = "json"; |
|||
context.Response.Write("Hello World"); |
|||
} |
|||
|
|||
public bool IsReusable |
|||
{ |
|||
get |
|||
{ |
|||
return false; |
|||
} |
|||
} |
|||
//public string GetUnCompleteAsk()
|
|||
//{
|
|||
|
|||
//}
|
|||
} |
|||
} |
Loading…
Reference in new issue