diff --git a/SGGL/BLL/Common/Const.cs b/SGGL/BLL/Common/Const.cs index 146dba2b..1697a864 100644 --- a/SGGL/BLL/Common/Const.cs +++ b/SGGL/BLL/Common/Const.cs @@ -747,10 +747,15 @@ namespace BLL public const string sysglyId = "AF17168B-87BD-4GLY-1111-F0A0A1158F9B"; /// - /// 系统管理员ID + /// 合肥诺必达管理员ID /// public const string hfnbdId = "C4A62EC0-E5D3-4EBF-A5FA-E56AA89633C0"; + /// + /// 罗菲账号ID + /// + public const string luofeiId = "cbebdb72-a304-4a5c-a218-df9ab0f14088"; + /// /// 公共临时账户ID /// diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index e4ecfa32..3288e4ac 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -2289,6 +2289,7 @@ + @@ -15754,6 +15755,13 @@ PersonUnitList.aspx + + PersonAddFromUser.aspx + ASPXCodeBehind + + + PersonAddFromUser.aspx + WorkPostStatistic.aspx ASPXCodeBehind diff --git a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonAddFromUser.aspx b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonAddFromUser.aspx new file mode 100644 index 00000000..799ef3ba --- /dev/null +++ b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonAddFromUser.aspx @@ -0,0 +1,98 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PersonAddFromUser.aspx.cs" Inherits="FineUIPro.Web.HSSE.SitePerson.PersonAddFromUser" %> + + + + + + 用户信息 + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonAddFromUser.aspx.cs b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonAddFromUser.aspx.cs new file mode 100644 index 00000000..68a26ab5 --- /dev/null +++ b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonAddFromUser.aspx.cs @@ -0,0 +1,222 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Text; + +namespace FineUIPro.Web.HSSE.SitePerson +{ + public partial class PersonAddFromUser : PageBase + { + /// + /// 定义项 + /// + public string ProjectId + { + get + { + return (string)ViewState["ProjectId"]; + } + set + { + ViewState["ProjectId"] = value; + } + } + + #region 加载 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + Funs.DropDownPageSize(this.ddlPageSize); + this.ProjectId = Request.QueryString["ProjectId"]; + if (this.CurrUser != null && this.CurrUser.PageSize.HasValue) + { + Grid1.PageSize = this.CurrUser.PageSize.Value; + } + this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); + + BLL.UnitService.InitUnitDropDownList(this.drpUnit, this.ProjectId, true); + //if (!string.IsNullOrEmpty(this.CurrUser.UnitId)) + //{ + // this.drpUnit.SelectedValue = this.CurrUser.UnitId; + //} + // 绑定表格 + this.BindGrid(); + } + } + #endregion + + /// + /// 绑定数据 + /// + private void BindGrid() + { + if (!string.IsNullOrEmpty(this.ProjectId)) + { + StringBuilder sb = new StringBuilder(); + sb.Append("SELECT Users.UserId,Users.UserCode,Users.UserName,Users.IdentityCard,Unit.UnitName,RoleName=STUFF(( SELECT ',' + RoleName FROM dbo.Sys_Role where PATINDEX('%,' + RTRIM(RoleId) + ',%',',' +Users.RoleId + ',')>0 FOR XML PATH('')), 1, 1,'') "); + sb.Append("FROM Sys_User AS Users "); + sb.Append("LEFT JOIN Project_ProjectUnit AS ProjectUnit ON Users.UnitId =ProjectUnit.UnitId "); + sb.Append("LEFT JOIN Base_Unit AS Unit ON Users.UnitId =Unit.UnitId "); + sb.Append("WHERE ProjectUnit.ProjectId =@ProjectId "); + sb.Append("AND Users.IdentityCard IS NOT NULL "); + sb.Append("AND Users.IdentityCard NOT IN (SELECT IdentityCard FROM SitePerson_Person WHERE ProjectId =ProjectUnit.ProjectId) "); + + List listStr = new List(); + + listStr.Add(new SqlParameter("@ProjectId", this.ProjectId)); + if (!string.IsNullOrEmpty(this.drpUnit.SelectedValue) && this.drpUnit.SelectedValue != Const._Null) + { + sb.Append("AND ProjectUnit.UnitId=@UnitId "); + listStr.Add(new SqlParameter("@UnitId", this.drpUnit.SelectedValue)); + } + if (!string.IsNullOrEmpty(this.txtUserName.Text.Trim())) + { + sb.Append("AND Users.UserName LIKE @UserName "); + listStr.Add(new SqlParameter("@UserName", "%" + this.txtUserName.Text.Trim() + "%")); + } + + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(sb.ToString(), parameter); + Grid1.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid1, tb); + Grid1.DataSource = table; + Grid1.DataBind(); + } + } + + #region 排序 分页 + /// + /// + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + Grid1.PageIndex = e.NewPageIndex; + BindGrid(); + } + + /// + /// + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + + /// + /// + /// + /// + /// + protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + Grid1.SortDirection = e.SortDirection; + Grid1.SortField = e.SortField; + BindGrid(); + } + #endregion + + /// + /// 确定按钮事件 + /// + /// + /// + protected void btnSure_Click(object sender, EventArgs e) + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); + return; + } + foreach (int rowIndex in Grid1.SelectedRowIndexArray) + { + var ssss = Grid1.DataKeys[rowIndex][0].ToString(); + this.SaveData(Grid1.DataKeys[rowIndex][0].ToString()); + } + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + } + + /// + /// 双击事件 + /// + /// + /// + protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); + return; + } + + this.SaveData(Grid1.SelectedRowID); + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + } + + #region 查询 + /// + /// 查询 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + #endregion + + /// + /// 保存数据 + /// + /// + private void SaveData(string IdentityCard) + { + var sitePerson = BLL.PersonService.GetPersonByIdentityCard(this.ProjectId, IdentityCard); + if (sitePerson == null) + { + var user = BLL.UserService.GetUserByIdentityCard(IdentityCard); + if (user != null) + { + Model.SitePerson_Person newPerson = new Model.SitePerson_Person + { + ProjectId = this.ProjectId, + PersonId = SQLHelper.GetNewID(typeof(Model.SitePerson_Person)), + UnitId = user.UnitId, + IdentityCard = user.IdentityCard, + IdcardType = "SHENFEN_ZHENGJIAN", + IdcardForever = "N", + PersonName = user.UserName, + Sex = user.Sex, + Telephone = user.Telephone, + IsUsed = true, + MainCNProfessionalId = user.MainCNProfessionalId, + ViceCNProfessionalId = user.ViceCNProfessionalId, + IsForeign = false, + IsOutside = false, + IsSafetyMonitoring = false, + }; + if (!string.IsNullOrWhiteSpace(user.RoleId)) + { + string roleId = user.RoleId.Split(',')[0]; + var role = RoleService.GetRoleByRoleId(roleId); + var workPost = WorkPostService.GetWorkPostByName(role.RoleName); + newPerson.WorkPostId = workPost.WorkPostId; + } + BLL.PersonService.AddPerson(newPerson); + } + } + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonAddFromUser.aspx.designer.cs b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonAddFromUser.aspx.designer.cs new file mode 100644 index 00000000..fec7bfc8 --- /dev/null +++ b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonAddFromUser.aspx.designer.cs @@ -0,0 +1,143 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.HSSE.SitePerson +{ + + + public partial class PersonAddFromUser + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// drpUnit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpUnit; + + /// + /// txtUserName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtUserName; + + /// + /// btnSure 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSure; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + + /// + /// Menu1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuSure 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuSure; + } +} diff --git a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonList.aspx b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonList.aspx index ecd9055c..af9ef53f 100644 --- a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonList.aspx +++ b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonList.aspx @@ -99,20 +99,15 @@ + - - - - - - - - - + + + + + + + @@ -191,6 +186,10 @@ Target="Parent" EnableResize="false" runat="server" OnClose="Window3_Close" IsModal="true" Width="800px" Height="550px"> +