基础字典补充:员工分类、员工子组、机构划分
This commit is contained in:
@@ -0,0 +1,155 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EmployeeCategory.aspx.cs" Inherits="FineUIPro.Web.BaseInfo.EmployeeCategory" %>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<title>员工分类</title>
|
||||
<link href="../res/css/common.css" rel="stylesheet" type="text/css" />
|
||||
<style type="text/css">
|
||||
.f-grid-row .f-grid-cell-inner {
|
||||
white-space: normal;
|
||||
word-break: break-all;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
|
||||
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" Title="员工分类" ShowHeader="false"
|
||||
Layout="HBox">
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" Title="员工分类" ShowHeader="false" EnableCollapse="true" PageSize="10" EnableColumnLines="true"
|
||||
ShowBorder="true" AllowPaging="true" IsDatabasePaging="true" runat="server" Width="750px" ForceFit="true"
|
||||
DataKeyNames="CategoryId" DataIDField="CategoryId" OnPageIndexChange="Grid1_PageIndexChange" AllowFilters="true" OnFilterChange="Grid1_FilterChange" EnableTextSelection="True">
|
||||
<Columns>
|
||||
<f:TemplateField HeaderText="序号" HeaderTextAlign="Center" TextAlign="Center" Width="50px">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label1" runat="server" Text='<%# Container.DataItemIndex + 1 %>' ></asp:Label>
|
||||
</ItemTemplate>
|
||||
</f:TemplateField>
|
||||
<f:RenderField ColumnID="CategoryCode" DataField="CategoryCode" FieldType="String"
|
||||
HeaderText="员工分类编号" HeaderTextAlign="Center" TextAlign="Center" Width="150px">
|
||||
</f:RenderField>
|
||||
<f:RenderField ColumnID="CategoryName" DataField="CategoryName" FieldType="String"
|
||||
HeaderText="员工分类名称" HeaderTextAlign="Center" TextAlign="Left" Width="250px">
|
||||
</f:RenderField>
|
||||
<f:RenderField ColumnID="Remark" DataField="Remark" FieldType="String"
|
||||
HeaderText="备注" HeaderTextAlign="Center" TextAlign="Left" Width="250px">
|
||||
</f:RenderField>
|
||||
</Columns>
|
||||
<Listeners>
|
||||
<f:Listener Event="rowselect" Handler="onGridRowSelect" />
|
||||
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
|
||||
</Listeners>
|
||||
<PageItems>
|
||||
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
|
||||
</f:ToolbarSeparator>
|
||||
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
|
||||
</f:ToolbarText>
|
||||
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
|
||||
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
|
||||
</f:DropDownList>
|
||||
</PageItems>
|
||||
</f:Grid>
|
||||
<f:SimpleForm ID="SimpleForm1" runat="server" ShowBorder="true" ShowHeader="false"
|
||||
LabelWidth="80px" BodyPadding="5px" Width="350px">
|
||||
<Items>
|
||||
<f:HiddenField ID="hfFormID" runat="server">
|
||||
</f:HiddenField>
|
||||
<f:TextBox ID="txtCategoryCode" Label="编号" ShowRedStar="true" Required="true" runat="server" MaxLength="50"
|
||||
LabelAlign="right" AutoPostBack="true" OnTextChanged="TextBox_TextChanged">
|
||||
</f:TextBox>
|
||||
<f:TextBox ID="txtCategoryName" Label="名称" ShowRedStar="true" Required="true" runat="server" MaxLength="100"
|
||||
LabelAlign="right" AutoPostBack="true" OnTextChanged="TextBox_TextChanged">
|
||||
</f:TextBox>
|
||||
<f:TextArea ID="txtRemark" runat="server" Label="备注" LabelAlign="right" MaxLength="200">
|
||||
</f:TextArea>
|
||||
</Items>
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar1" Position="Bottom" runat="server">
|
||||
<Items>
|
||||
<f:Button ID="btnNew" Icon="Add" ToolTip="新增" EnablePostBack="false" runat="server" Hidden="true">
|
||||
<Listeners>
|
||||
<f:Listener Event="click" Handler="onNewButtonClick" />
|
||||
</Listeners>
|
||||
</f:Button>
|
||||
<f:Button ID="btnDelete" Enabled="false" ToolTip="删除" Icon="Delete" ConfirmText="确定删除当前数据?" Hidden="true"
|
||||
OnClick="btnDelete_Click" runat="server">
|
||||
</f:Button>
|
||||
<f:ToolbarFill ID="ToolbarFill1" runat="server">
|
||||
</f:ToolbarFill>
|
||||
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ValidateForms="SimpleForm1" Hidden="true"
|
||||
OnClick="btnSave_Click">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
</f:SimpleForm>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
<f:Menu ID="Menu1" runat="server">
|
||||
<f:MenuButton ID="btnMenuEdit" OnClick="btnMenuEdit_Click" EnablePostBack="true" Hidden="true"
|
||||
runat="server" Text="编辑" Icon="Pencil">
|
||||
</f:MenuButton>
|
||||
<f:MenuButton ID="btnMenuDelete" OnClick="btnMenuDelete_Click" EnablePostBack="true" Hidden="true"
|
||||
ConfirmText="删除选中行?" ConfirmTarget="Parent" runat="server" Text="删除" Icon="Delete">
|
||||
</f:MenuButton>
|
||||
</f:Menu>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
var menuID = '<%= Menu1.ClientID %>';
|
||||
// 返回false,来阻止浏览器右键菜单
|
||||
function onRowContextMenu(event, rowId) {
|
||||
F(menuID).show(); //showAt(event.pageX, event.pageY);
|
||||
return false;
|
||||
}
|
||||
|
||||
function reloadGrid() {
|
||||
__doPostBack(null, 'reloadGrid');
|
||||
}
|
||||
|
||||
var gridClientID = '<%= Grid1.ClientID %>';
|
||||
var btnDeleteClientID = '<%= btnDelete.ClientID %>';
|
||||
var btnSaveClientID = '<%= btnSave.ClientID %>';
|
||||
|
||||
var formClientID = '<%= SimpleForm1.ClientID %>';
|
||||
var hfFormIDClientID = '<%= hfFormID.ClientID %>';
|
||||
var txtCodeClientID = '<%= txtCategoryCode.ClientID %>';
|
||||
var txtNameClientID = '<%= txtCategoryName.ClientID %>';
|
||||
var txtRemarkClientID = '<%=txtRemark.ClientID %>';
|
||||
|
||||
function onGridRowSelect(event, rowId) {
|
||||
var grid = F(gridClientID);
|
||||
|
||||
// 启用删除按钮
|
||||
F(btnDeleteClientID).enable();
|
||||
|
||||
// 当前行数据
|
||||
var rowValue = grid.getRowValue(rowId);
|
||||
|
||||
// 使用当前行数据填充表单字段
|
||||
F(hfFormIDClientID).setValue(rowId);
|
||||
F(txtCodeClientID).setValue(rowValue['CategoryCode']);
|
||||
F(txtNameClientID).setValue(rowValue['CategoryName']);
|
||||
F(txtRemarkClientID).setValue(rowValue['Remark']);
|
||||
|
||||
// 更新保存按钮文本
|
||||
// F(btnSaveClientID).setText('保存数据(编辑)');
|
||||
}
|
||||
|
||||
function onNewButtonClick() {
|
||||
// 重置表单字段
|
||||
F(formClientID).reset();
|
||||
F(hfFormIDClientID).reset();
|
||||
// 清空表格选中行
|
||||
F(gridClientID).clearSelections();
|
||||
// 禁用删除按钮
|
||||
F(btnDeleteClientID).disable();
|
||||
|
||||
// 更新保存按钮文本
|
||||
// F(btnSaveClientID).setText('保存数据(新增)');
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,286 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using BLL;
|
||||
|
||||
namespace FineUIPro.Web.BaseInfo
|
||||
{
|
||||
public partial class EmployeeCategory : PageBase
|
||||
{
|
||||
#region 加载页面
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
////权限按钮方法
|
||||
this.GetButtonPower();
|
||||
Funs.DropDownPageSize(this.ddlPageSize);
|
||||
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
||||
// 绑定表格
|
||||
BindGrid();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绑定数据
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
var q = from x in Funs.DB.Base_EmployeeCategory orderby x.CategoryCode select x;
|
||||
Grid1.RecordCount = q.Count();
|
||||
// 2.获取当前分页数据
|
||||
var table = GetPagedDataTable(Grid1.PageIndex, Grid1.PageSize);
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private List<Model.Base_EmployeeCategory> GetPagedDataTable(int pageIndex, int pageSize)
|
||||
{
|
||||
List<Model.Base_EmployeeCategory> source = (from x in Funs.DB.Base_EmployeeCategory orderby x.CategoryCode select x).ToList();
|
||||
List<Model.Base_EmployeeCategory> paged = new List<Model.Base_EmployeeCategory>();
|
||||
|
||||
int rowbegin = pageIndex * pageSize;
|
||||
int rowend = (pageIndex + 1) * pageSize;
|
||||
if (rowend > source.Count())
|
||||
{
|
||||
rowend = source.Count();
|
||||
}
|
||||
|
||||
for (int i = rowbegin; i < rowend; i++)
|
||||
{
|
||||
paged.Add(source[i]);
|
||||
}
|
||||
|
||||
return paged;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 改变索引事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
||||
{
|
||||
Grid1.PageIndex = e.NewPageIndex;
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页下拉选择
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 过滤表头
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_FilterChange(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 删除
|
||||
/// <summary>
|
||||
/// 删除
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (judgementDelete(hfFormID.Text, true))
|
||||
{
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, this.txtCategoryCode.Text, hfFormID.Text, BLL.Const.EmployeeCategoryMenuId, BLL.Const.BtnDelete);
|
||||
BLL.EmployeeCategoryService.DeleteCategoryById(hfFormID.Text);
|
||||
|
||||
// 重新绑定表格,并模拟点击[新增按钮]
|
||||
BindGrid();
|
||||
PageContext.RegisterStartupScript("onNewButtonClick();");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 右键删除事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length > 0)
|
||||
{
|
||||
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
||||
{
|
||||
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
||||
if (judgementDelete(rowID, true))
|
||||
{
|
||||
var getV = BLL.EmployeeCategoryService.GetCategoryById(rowID);
|
||||
if (getV != null)
|
||||
{
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, getV.CategoryCode, getV.CategoryId, BLL.Const.EmployeeCategoryMenuId, BLL.Const.BtnDelete);
|
||||
BLL.EmployeeCategoryService.DeleteCategoryById(rowID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
PageContext.RegisterStartupScript("onNewButtonClick();");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断是否可删除
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="isShow"></param>
|
||||
/// <returns></returns>
|
||||
private bool judgementDelete(string id, bool isShow)
|
||||
{
|
||||
string content = string.Empty;
|
||||
if (Funs.DB.SitePerson_Person.FirstOrDefault(x => x.EmployeeCategoryId == id) != null)
|
||||
{
|
||||
content = "该分类已在【人员信息】中使用,不能删除!";
|
||||
}
|
||||
if (string.IsNullOrEmpty(content))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isShow)
|
||||
{
|
||||
Alert.ShowInTop(content);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 编辑
|
||||
/// <summary>
|
||||
/// 右键编辑事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
Alert.ShowInTop("请至少选择一条记录!");
|
||||
return;
|
||||
}
|
||||
string Id = Grid1.SelectedRowID;
|
||||
var Category = BLL.EmployeeCategoryService.GetCategoryById(Id);
|
||||
if (Category != null)
|
||||
{
|
||||
this.txtCategoryCode.Text = Category.CategoryCode;
|
||||
this.txtCategoryName.Text = Category.CategoryName;
|
||||
this.txtRemark.Text = Category.Remark;
|
||||
hfFormID.Text = Id;
|
||||
this.btnDelete.Enabled = true;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存
|
||||
/// <summary>
|
||||
/// 保存按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
string strRowID = hfFormID.Text;
|
||||
Model.Base_EmployeeCategory newCategory = new Model.Base_EmployeeCategory
|
||||
{
|
||||
CategoryCode = this.txtCategoryCode.Text.Trim(),
|
||||
CategoryName = this.txtCategoryName.Text.Trim(),
|
||||
Remark = txtRemark.Text.Trim()
|
||||
};
|
||||
if (string.IsNullOrEmpty(strRowID))
|
||||
{
|
||||
newCategory.CategoryId = SQLHelper.GetNewID(typeof(Model.Base_EmployeeCategory));
|
||||
BLL.EmployeeCategoryService.AddCategory(newCategory);
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, newCategory.CategoryCode, newCategory.CategoryId, BLL.Const.EmployeeCategoryMenuId, BLL.Const.BtnAdd);
|
||||
}
|
||||
else
|
||||
{
|
||||
newCategory.CategoryId = strRowID;
|
||||
BLL.EmployeeCategoryService.UpdateCategory(newCategory);
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, newCategory.CategoryCode, newCategory.CategoryId, BLL.Const.EmployeeCategoryMenuId, BLL.Const.BtnModify);
|
||||
}
|
||||
this.SimpleForm1.Reset();
|
||||
// 重新绑定表格,并点击当前编辑或者新增的行
|
||||
BindGrid();
|
||||
PageContext.RegisterStartupScript(String.Format("F('{0}').selectRow('{1}');", Grid1.ClientID, newCategory.CategoryId));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 验证职称信息名称、编号是否存在
|
||||
/// <summary>
|
||||
/// 验证职称信息名称、编号是否存在
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void TextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
var q = Funs.DB.Base_EmployeeCategory.FirstOrDefault(x => x.CategoryCode == this.txtCategoryCode.Text.Trim() && (x.CategoryId != hfFormID.Text || (hfFormID.Text == null && x.CategoryId != null)));
|
||||
if (q != null)
|
||||
{
|
||||
ShowNotify("输入的职称编号已存在!", MessageBoxIcon.Warning);
|
||||
}
|
||||
|
||||
var q2 = Funs.DB.Base_EmployeeCategory.FirstOrDefault(x => x.CategoryName == this.txtCategoryName.Text.Trim() && (x.CategoryId != hfFormID.Text || (hfFormID.Text == null && x.CategoryId != null)));
|
||||
if (q2 != null)
|
||||
{
|
||||
ShowNotify("输入的职称名称已存在!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取按钮权限
|
||||
/// <summary>
|
||||
/// 获取按钮权限
|
||||
/// </summary>
|
||||
/// <param name="button"></param>
|
||||
/// <returns></returns>
|
||||
private void GetButtonPower()
|
||||
{
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.EmployeeCategoryMenuId);
|
||||
if (buttonList.Count() > 0)
|
||||
{
|
||||
if (buttonList.Contains(BLL.Const.BtnAdd))
|
||||
{
|
||||
this.btnNew.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnModify))
|
||||
{
|
||||
this.btnMenuEdit.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnDelete))
|
||||
{
|
||||
this.btnDelete.Hidden = false;
|
||||
this.btnMenuDelete.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnSave))
|
||||
{
|
||||
this.btnSave.Hidden = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.BaseInfo
|
||||
{
|
||||
|
||||
|
||||
public partial class EmployeeCategory
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
/// <summary>
|
||||
/// Panel1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel1;
|
||||
|
||||
/// <summary>
|
||||
/// Grid1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid Grid1;
|
||||
|
||||
/// <summary>
|
||||
/// Label1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label Label1;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarSeparator1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarText1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarText ToolbarText1;
|
||||
|
||||
/// <summary>
|
||||
/// ddlPageSize 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList ddlPageSize;
|
||||
|
||||
/// <summary>
|
||||
/// SimpleForm1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.SimpleForm SimpleForm1;
|
||||
|
||||
/// <summary>
|
||||
/// hfFormID 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.HiddenField hfFormID;
|
||||
|
||||
/// <summary>
|
||||
/// txtCategoryCode 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtCategoryCode;
|
||||
|
||||
/// <summary>
|
||||
/// txtCategoryName 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtCategoryName;
|
||||
|
||||
/// <summary>
|
||||
/// txtRemark 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextArea txtRemark;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar1;
|
||||
|
||||
/// <summary>
|
||||
/// btnNew 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnNew;
|
||||
|
||||
/// <summary>
|
||||
/// btnDelete 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnDelete;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarFill1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarFill ToolbarFill1;
|
||||
|
||||
/// <summary>
|
||||
/// btnSave 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSave;
|
||||
|
||||
/// <summary>
|
||||
/// Menu1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Menu Menu1;
|
||||
|
||||
/// <summary>
|
||||
/// btnMenuEdit 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.MenuButton btnMenuEdit;
|
||||
|
||||
/// <summary>
|
||||
/// btnMenuDelete 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.MenuButton btnMenuDelete;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EmployeeSubgroup.aspx.cs" Inherits="FineUIPro.Web.BaseInfo.EmployeeSubgroup" %>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<title>员工子组</title>
|
||||
<link href="../res/css/common.css" rel="stylesheet" type="text/css" />
|
||||
<style type="text/css">
|
||||
.f-grid-row .f-grid-cell-inner {
|
||||
white-space: normal;
|
||||
word-break: break-all;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
|
||||
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" Title="员工子组" ShowHeader="false"
|
||||
Layout="HBox">
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" Title="员工子组" ShowHeader="false" EnableCollapse="true" PageSize="10" EnableColumnLines="true"
|
||||
ShowBorder="true" AllowPaging="true" IsDatabasePaging="true" runat="server" Width="750px" ForceFit="true"
|
||||
DataKeyNames="SubgroupId" DataIDField="SubgroupId" OnPageIndexChange="Grid1_PageIndexChange" AllowFilters="true" OnFilterChange="Grid1_FilterChange" EnableTextSelection="True">
|
||||
<Columns>
|
||||
<f:TemplateField HeaderText="序号" HeaderTextAlign="Center" TextAlign="Center" Width="50px">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label1" runat="server" Text='<%# Container.DataItemIndex + 1 %>' ></asp:Label>
|
||||
</ItemTemplate>
|
||||
</f:TemplateField>
|
||||
<f:RenderField ColumnID="SubgroupCode" DataField="SubgroupCode" FieldType="String"
|
||||
HeaderText="员工子组编号" HeaderTextAlign="Center" TextAlign="Center" Width="150px">
|
||||
</f:RenderField>
|
||||
<f:RenderField ColumnID="SubgroupName" DataField="SubgroupName" FieldType="String"
|
||||
HeaderText="员工子组名称" HeaderTextAlign="Center" TextAlign="Left" Width="250px">
|
||||
</f:RenderField>
|
||||
<f:RenderField ColumnID="Remark" DataField="Remark" FieldType="String"
|
||||
HeaderText="备注" HeaderTextAlign="Center" TextAlign="Left" Width="250px">
|
||||
</f:RenderField>
|
||||
</Columns>
|
||||
<Listeners>
|
||||
<f:Listener Event="rowselect" Handler="onGridRowSelect" />
|
||||
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
|
||||
</Listeners>
|
||||
<PageItems>
|
||||
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
|
||||
</f:ToolbarSeparator>
|
||||
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
|
||||
</f:ToolbarText>
|
||||
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
|
||||
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
|
||||
</f:DropDownList>
|
||||
</PageItems>
|
||||
</f:Grid>
|
||||
<f:SimpleForm ID="SimpleForm1" runat="server" ShowBorder="true" ShowHeader="false"
|
||||
LabelWidth="80px" BodyPadding="5px" Width="350px">
|
||||
<Items>
|
||||
<f:HiddenField ID="hfFormID" runat="server">
|
||||
</f:HiddenField>
|
||||
<f:TextBox ID="txtSubgroupCode" Label="编号" ShowRedStar="true" Required="true" runat="server" MaxLength="50"
|
||||
LabelAlign="right" AutoPostBack="true" OnTextChanged="TextBox_TextChanged">
|
||||
</f:TextBox>
|
||||
<f:TextBox ID="txtSubgroupName" Label="名称" ShowRedStar="true" Required="true" runat="server" MaxLength="100"
|
||||
LabelAlign="right" AutoPostBack="true" OnTextChanged="TextBox_TextChanged">
|
||||
</f:TextBox>
|
||||
<f:TextArea ID="txtRemark" runat="server" Label="备注" LabelAlign="right" MaxLength="200">
|
||||
</f:TextArea>
|
||||
</Items>
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar1" Position="Bottom" runat="server">
|
||||
<Items>
|
||||
<f:Button ID="btnNew" Icon="Add" ToolTip="新增" EnablePostBack="false" runat="server" Hidden="true">
|
||||
<Listeners>
|
||||
<f:Listener Event="click" Handler="onNewButtonClick" />
|
||||
</Listeners>
|
||||
</f:Button>
|
||||
<f:Button ID="btnDelete" Enabled="false" ToolTip="删除" Icon="Delete" ConfirmText="确定删除当前数据?" Hidden="true"
|
||||
OnClick="btnDelete_Click" runat="server">
|
||||
</f:Button>
|
||||
<f:ToolbarFill ID="ToolbarFill1" runat="server">
|
||||
</f:ToolbarFill>
|
||||
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ValidateForms="SimpleForm1" Hidden="true"
|
||||
OnClick="btnSave_Click">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
</f:SimpleForm>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
<f:Menu ID="Menu1" runat="server">
|
||||
<f:MenuButton ID="btnMenuEdit" OnClick="btnMenuEdit_Click" EnablePostBack="true" Hidden="true"
|
||||
runat="server" Text="编辑" Icon="Pencil">
|
||||
</f:MenuButton>
|
||||
<f:MenuButton ID="btnMenuDelete" OnClick="btnMenuDelete_Click" EnablePostBack="true" Hidden="true"
|
||||
ConfirmText="删除选中行?" ConfirmTarget="Parent" runat="server" Text="删除" Icon="Delete">
|
||||
</f:MenuButton>
|
||||
</f:Menu>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
var menuID = '<%= Menu1.ClientID %>';
|
||||
// 返回false,来阻止浏览器右键菜单
|
||||
function onRowContextMenu(event, rowId) {
|
||||
F(menuID).show(); //showAt(event.pageX, event.pageY);
|
||||
return false;
|
||||
}
|
||||
|
||||
function reloadGrid() {
|
||||
__doPostBack(null, 'reloadGrid');
|
||||
}
|
||||
|
||||
var gridClientID = '<%= Grid1.ClientID %>';
|
||||
var btnDeleteClientID = '<%= btnDelete.ClientID %>';
|
||||
var btnSaveClientID = '<%= btnSave.ClientID %>';
|
||||
|
||||
var formClientID = '<%= SimpleForm1.ClientID %>';
|
||||
var hfFormIDClientID = '<%= hfFormID.ClientID %>';
|
||||
var txtCodeClientID = '<%= txtSubgroupCode.ClientID %>';
|
||||
var txtNameClientID = '<%= txtSubgroupName.ClientID %>';
|
||||
var txtRemarkClientID = '<%=txtRemark.ClientID %>';
|
||||
|
||||
function onGridRowSelect(event, rowId) {
|
||||
var grid = F(gridClientID);
|
||||
|
||||
// 启用删除按钮
|
||||
F(btnDeleteClientID).enable();
|
||||
|
||||
// 当前行数据
|
||||
var rowValue = grid.getRowValue(rowId);
|
||||
|
||||
// 使用当前行数据填充表单字段
|
||||
F(hfFormIDClientID).setValue(rowId);
|
||||
F(txtCodeClientID).setValue(rowValue['SubgroupCode']);
|
||||
F(txtNameClientID).setValue(rowValue['SubgroupName']);
|
||||
F(txtRemarkClientID).setValue(rowValue['Remark']);
|
||||
|
||||
// 更新保存按钮文本
|
||||
// F(btnSaveClientID).setText('保存数据(编辑)');
|
||||
}
|
||||
|
||||
function onNewButtonClick() {
|
||||
// 重置表单字段
|
||||
F(formClientID).reset();
|
||||
F(hfFormIDClientID).reset();
|
||||
// 清空表格选中行
|
||||
F(gridClientID).clearSelections();
|
||||
// 禁用删除按钮
|
||||
F(btnDeleteClientID).disable();
|
||||
|
||||
// 更新保存按钮文本
|
||||
// F(btnSaveClientID).setText('保存数据(新增)');
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,286 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using BLL;
|
||||
|
||||
namespace FineUIPro.Web.BaseInfo
|
||||
{
|
||||
public partial class EmployeeSubgroup: PageBase
|
||||
{
|
||||
#region 加载页面
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
////权限按钮方法
|
||||
this.GetButtonPower();
|
||||
Funs.DropDownPageSize(this.ddlPageSize);
|
||||
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
||||
// 绑定表格
|
||||
BindGrid();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绑定数据
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
var q = from x in Funs.DB.Base_EmployeeSubgroup orderby x.SubgroupCode select x;
|
||||
Grid1.RecordCount = q.Count();
|
||||
// 2.获取当前分页数据
|
||||
var table = GetPagedDataTable(Grid1.PageIndex, Grid1.PageSize);
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private List<Model.Base_EmployeeSubgroup> GetPagedDataTable(int pageIndex, int pageSize)
|
||||
{
|
||||
List<Model.Base_EmployeeSubgroup> source = (from x in Funs.DB.Base_EmployeeSubgroup orderby x.SubgroupCode select x).ToList();
|
||||
List<Model.Base_EmployeeSubgroup> paged = new List<Model.Base_EmployeeSubgroup>();
|
||||
|
||||
int rowbegin = pageIndex * pageSize;
|
||||
int rowend = (pageIndex + 1) * pageSize;
|
||||
if (rowend > source.Count())
|
||||
{
|
||||
rowend = source.Count();
|
||||
}
|
||||
|
||||
for (int i = rowbegin; i < rowend; i++)
|
||||
{
|
||||
paged.Add(source[i]);
|
||||
}
|
||||
|
||||
return paged;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 改变索引事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
||||
{
|
||||
Grid1.PageIndex = e.NewPageIndex;
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页下拉选择
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 过滤表头
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_FilterChange(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 删除
|
||||
/// <summary>
|
||||
/// 删除
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (judgementDelete(hfFormID.Text, true))
|
||||
{
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, this.txtSubgroupCode.Text, hfFormID.Text, BLL.Const.EmployeeSubgroupMenuId, BLL.Const.BtnDelete);
|
||||
BLL.EmployeeSubgroupService.DeleteSubgroupById(hfFormID.Text);
|
||||
|
||||
// 重新绑定表格,并模拟点击[新增按钮]
|
||||
BindGrid();
|
||||
PageContext.RegisterStartupScript("onNewButtonClick();");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 右键删除事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length > 0)
|
||||
{
|
||||
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
||||
{
|
||||
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
||||
if (judgementDelete(rowID, true))
|
||||
{
|
||||
var getV = BLL.EmployeeSubgroupService.GetSubgroupById(rowID);
|
||||
if (getV != null)
|
||||
{
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, getV.SubgroupCode, getV.SubgroupId, BLL.Const.EmployeeSubgroupMenuId, BLL.Const.BtnDelete);
|
||||
BLL.EmployeeSubgroupService.DeleteSubgroupById(rowID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
PageContext.RegisterStartupScript("onNewButtonClick();");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断是否可删除
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="isShow"></param>
|
||||
/// <returns></returns>
|
||||
private bool judgementDelete(string id, bool isShow)
|
||||
{
|
||||
string content = string.Empty;
|
||||
if (Funs.DB.SitePerson_Person.FirstOrDefault(x => x.EmployeeSubgroupId == id) != null)
|
||||
{
|
||||
content = "该分类已在【人员信息】中使用,不能删除!";
|
||||
}
|
||||
if (string.IsNullOrEmpty(content))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isShow)
|
||||
{
|
||||
Alert.ShowInTop(content);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 编辑
|
||||
/// <summary>
|
||||
/// 右键编辑事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
Alert.ShowInTop("请至少选择一条记录!");
|
||||
return;
|
||||
}
|
||||
string Id = Grid1.SelectedRowID;
|
||||
var Subgroup= BLL.EmployeeSubgroupService.GetSubgroupById(Id);
|
||||
if (Subgroup!= null)
|
||||
{
|
||||
this.txtSubgroupCode.Text = Subgroup.SubgroupCode;
|
||||
this.txtSubgroupName.Text = Subgroup.SubgroupName;
|
||||
this.txtRemark.Text = Subgroup.Remark;
|
||||
hfFormID.Text = Id;
|
||||
this.btnDelete.Enabled = true;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存
|
||||
/// <summary>
|
||||
/// 保存按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
string strRowID = hfFormID.Text;
|
||||
Model.Base_EmployeeSubgroup newSubgroup= new Model.Base_EmployeeSubgroup
|
||||
{
|
||||
SubgroupCode = this.txtSubgroupCode.Text.Trim(),
|
||||
SubgroupName = this.txtSubgroupName.Text.Trim(),
|
||||
Remark = txtRemark.Text.Trim()
|
||||
};
|
||||
if (string.IsNullOrEmpty(strRowID))
|
||||
{
|
||||
newSubgroup.SubgroupId = SQLHelper.GetNewID(typeof(Model.Base_EmployeeSubgroup));
|
||||
BLL.EmployeeSubgroupService.AddSubgroup(newSubgroup);
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, newSubgroup.SubgroupCode, newSubgroup.SubgroupId, BLL.Const.EmployeeSubgroupMenuId, BLL.Const.BtnAdd);
|
||||
}
|
||||
else
|
||||
{
|
||||
newSubgroup.SubgroupId = strRowID;
|
||||
BLL.EmployeeSubgroupService.UpdateSubgroup(newSubgroup);
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, newSubgroup.SubgroupCode, newSubgroup.SubgroupId, BLL.Const.EmployeeSubgroupMenuId, BLL.Const.BtnModify);
|
||||
}
|
||||
this.SimpleForm1.Reset();
|
||||
// 重新绑定表格,并点击当前编辑或者新增的行
|
||||
BindGrid();
|
||||
PageContext.RegisterStartupScript(String.Format("F('{0}').selectRow('{1}');", Grid1.ClientID, newSubgroup.SubgroupId));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 验证职称信息名称、编号是否存在
|
||||
/// <summary>
|
||||
/// 验证职称信息名称、编号是否存在
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void TextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
var q = Funs.DB.Base_EmployeeSubgroup.FirstOrDefault(x => x.SubgroupCode == this.txtSubgroupCode.Text.Trim() && (x.SubgroupId != hfFormID.Text || (hfFormID.Text == null && x.SubgroupId != null)));
|
||||
if (q != null)
|
||||
{
|
||||
ShowNotify("输入的职称编号已存在!", MessageBoxIcon.Warning);
|
||||
}
|
||||
|
||||
var q2 = Funs.DB.Base_EmployeeSubgroup.FirstOrDefault(x => x.SubgroupName == this.txtSubgroupName.Text.Trim() && (x.SubgroupId != hfFormID.Text || (hfFormID.Text == null && x.SubgroupId != null)));
|
||||
if (q2 != null)
|
||||
{
|
||||
ShowNotify("输入的职称名称已存在!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取按钮权限
|
||||
/// <summary>
|
||||
/// 获取按钮权限
|
||||
/// </summary>
|
||||
/// <param name="button"></param>
|
||||
/// <returns></returns>
|
||||
private void GetButtonPower()
|
||||
{
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.EmployeeSubgroupMenuId);
|
||||
if (buttonList.Count() > 0)
|
||||
{
|
||||
if (buttonList.Contains(BLL.Const.BtnAdd))
|
||||
{
|
||||
this.btnNew.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnModify))
|
||||
{
|
||||
this.btnMenuEdit.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnDelete))
|
||||
{
|
||||
this.btnDelete.Hidden = false;
|
||||
this.btnMenuDelete.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnSave))
|
||||
{
|
||||
this.btnSave.Hidden = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.BaseInfo
|
||||
{
|
||||
|
||||
|
||||
public partial class EmployeeSubgroup
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
/// <summary>
|
||||
/// Panel1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel1;
|
||||
|
||||
/// <summary>
|
||||
/// Grid1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid Grid1;
|
||||
|
||||
/// <summary>
|
||||
/// Label1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label Label1;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarSeparator1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarText1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarText ToolbarText1;
|
||||
|
||||
/// <summary>
|
||||
/// ddlPageSize 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList ddlPageSize;
|
||||
|
||||
/// <summary>
|
||||
/// SimpleForm1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.SimpleForm SimpleForm1;
|
||||
|
||||
/// <summary>
|
||||
/// hfFormID 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.HiddenField hfFormID;
|
||||
|
||||
/// <summary>
|
||||
/// txtSubgroupCode 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtSubgroupCode;
|
||||
|
||||
/// <summary>
|
||||
/// txtSubgroupName 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtSubgroupName;
|
||||
|
||||
/// <summary>
|
||||
/// txtRemark 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextArea txtRemark;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar1;
|
||||
|
||||
/// <summary>
|
||||
/// btnNew 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnNew;
|
||||
|
||||
/// <summary>
|
||||
/// btnDelete 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnDelete;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarFill1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarFill ToolbarFill1;
|
||||
|
||||
/// <summary>
|
||||
/// btnSave 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSave;
|
||||
|
||||
/// <summary>
|
||||
/// Menu1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Menu Menu1;
|
||||
|
||||
/// <summary>
|
||||
/// btnMenuEdit 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.MenuButton btnMenuEdit;
|
||||
|
||||
/// <summary>
|
||||
/// btnMenuDelete 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.MenuButton btnMenuDelete;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="InstitutionalDivision.aspx.cs" Inherits="FineUIPro.Web.BaseInfo.InstitutionalDivision" %>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<title>机构划分</title>
|
||||
<link href="../res/css/common.css" rel="stylesheet" type="text/css" />
|
||||
<style type="text/css">
|
||||
.f-grid-row .f-grid-cell-inner {
|
||||
white-space: normal;
|
||||
word-break: break-all;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
|
||||
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" Title="机构划分" ShowHeader="false"
|
||||
Layout="HBox">
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" Title="机构划分" ShowHeader="false" EnableCollapse="true" PageSize="10" EnableColumnLines="true"
|
||||
ShowBorder="true" AllowPaging="true" IsDatabasePaging="true" runat="server" Width="750px" ForceFit="true"
|
||||
DataKeyNames="Id" DataIDField="Id" OnPageIndexChange="Grid1_PageIndexChange" AllowFilters="true" OnFilterChange="Grid1_FilterChange" EnableTextSelection="True">
|
||||
<Columns>
|
||||
<f:TemplateField HeaderText="序号" HeaderTextAlign="Center" TextAlign="Center" Width="50px">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label1" runat="server" Text='<%# Container.DataItemIndex + 1 %>' ></asp:Label>
|
||||
</ItemTemplate>
|
||||
</f:TemplateField>
|
||||
<f:RenderField ColumnID="Code" DataField="Code" FieldType="String"
|
||||
HeaderText="机构划分编号" HeaderTextAlign="Center" TextAlign="Center" Width="150px">
|
||||
</f:RenderField>
|
||||
<f:RenderField ColumnID="Name" DataField="Name" FieldType="String"
|
||||
HeaderText="机构划分名称" HeaderTextAlign="Center" TextAlign="Left" Width="250px">
|
||||
</f:RenderField>
|
||||
<f:RenderField ColumnID="Remark" DataField="Remark" FieldType="String"
|
||||
HeaderText="备注" HeaderTextAlign="Center" TextAlign="Left" Width="250px">
|
||||
</f:RenderField>
|
||||
</Columns>
|
||||
<Listeners>
|
||||
<f:Listener Event="rowselect" Handler="onGridRowSelect" />
|
||||
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
|
||||
</Listeners>
|
||||
<PageItems>
|
||||
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
|
||||
</f:ToolbarSeparator>
|
||||
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
|
||||
</f:ToolbarText>
|
||||
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
|
||||
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
|
||||
</f:DropDownList>
|
||||
</PageItems>
|
||||
</f:Grid>
|
||||
<f:SimpleForm ID="SimpleForm1" runat="server" ShowBorder="true" ShowHeader="false"
|
||||
LabelWidth="80px" BodyPadding="5px" Width="350px">
|
||||
<Items>
|
||||
<f:HiddenField ID="hfFormID" runat="server">
|
||||
</f:HiddenField>
|
||||
<f:TextBox ID="txtCode" Label="编号" ShowRedStar="true" Required="true" runat="server" MaxLength="50"
|
||||
LabelAlign="right" AutoPostBack="true" OnTextChanged="TextBox_TextChanged">
|
||||
</f:TextBox>
|
||||
<f:TextBox ID="txtName" Label="名称" ShowRedStar="true" Required="true" runat="server" MaxLength="100"
|
||||
LabelAlign="right" AutoPostBack="true" OnTextChanged="TextBox_TextChanged">
|
||||
</f:TextBox>
|
||||
<f:TextArea ID="txtRemark" runat="server" Label="备注" LabelAlign="right" MaxLength="200">
|
||||
</f:TextArea>
|
||||
</Items>
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar1" Position="Bottom" runat="server">
|
||||
<Items>
|
||||
<f:Button ID="btnNew" Icon="Add" ToolTip="新增" EnablePostBack="false" runat="server" Hidden="true">
|
||||
<Listeners>
|
||||
<f:Listener Event="click" Handler="onNewButtonClick" />
|
||||
</Listeners>
|
||||
</f:Button>
|
||||
<f:Button ID="btnDelete" Enabled="false" ToolTip="删除" Icon="Delete" ConfirmText="确定删除当前数据?" Hidden="true"
|
||||
OnClick="btnDelete_Click" runat="server">
|
||||
</f:Button>
|
||||
<f:ToolbarFill ID="ToolbarFill1" runat="server">
|
||||
</f:ToolbarFill>
|
||||
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ValidateForms="SimpleForm1" Hidden="true"
|
||||
OnClick="btnSave_Click">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
</f:SimpleForm>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
<f:Menu ID="Menu1" runat="server">
|
||||
<f:MenuButton ID="btnMenuEdit" OnClick="btnMenuEdit_Click" EnablePostBack="true" Hidden="true"
|
||||
runat="server" Text="编辑" Icon="Pencil">
|
||||
</f:MenuButton>
|
||||
<f:MenuButton ID="btnMenuDelete" OnClick="btnMenuDelete_Click" EnablePostBack="true" Hidden="true"
|
||||
ConfirmText="删除选中行?" ConfirmTarget="Parent" runat="server" Text="删除" Icon="Delete">
|
||||
</f:MenuButton>
|
||||
</f:Menu>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
var menuID = '<%= Menu1.ClientID %>';
|
||||
// 返回false,来阻止浏览器右键菜单
|
||||
function onRowContextMenu(event, rowId) {
|
||||
F(menuID).show(); //showAt(event.pageX, event.pageY);
|
||||
return false;
|
||||
}
|
||||
|
||||
function reloadGrid() {
|
||||
__doPostBack(null, 'reloadGrid');
|
||||
}
|
||||
|
||||
var gridClientID = '<%= Grid1.ClientID %>';
|
||||
var btnDeleteClientID = '<%= btnDelete.ClientID %>';
|
||||
var btnSaveClientID = '<%= btnSave.ClientID %>';
|
||||
|
||||
var formClientID = '<%= SimpleForm1.ClientID %>';
|
||||
var hfFormIDClientID = '<%= hfFormID.ClientID %>';
|
||||
var txtCodeClientID = '<%= txtCode.ClientID %>';
|
||||
var txtNameClientID = '<%= txtName.ClientID %>';
|
||||
var txtRemarkClientID = '<%=txtRemark.ClientID %>';
|
||||
|
||||
function onGridRowSelect(event, rowId) {
|
||||
var grid = F(gridClientID);
|
||||
|
||||
// 启用删除按钮
|
||||
F(btnDeleteClientID).enable();
|
||||
|
||||
// 当前行数据
|
||||
var rowValue = grid.getRowValue(rowId);
|
||||
|
||||
// 使用当前行数据填充表单字段
|
||||
F(hfFormIDClientID).setValue(rowId);
|
||||
F(txtCodeClientID).setValue(rowValue['Code']);
|
||||
F(txtNameClientID).setValue(rowValue['Name']);
|
||||
F(txtRemarkClientID).setValue(rowValue['Remark']);
|
||||
|
||||
// 更新保存按钮文本
|
||||
// F(btnSaveClientID).setText('保存数据(编辑)');
|
||||
}
|
||||
|
||||
function onNewButtonClick() {
|
||||
// 重置表单字段
|
||||
F(formClientID).reset();
|
||||
F(hfFormIDClientID).reset();
|
||||
// 清空表格选中行
|
||||
F(gridClientID).clearSelections();
|
||||
// 禁用删除按钮
|
||||
F(btnDeleteClientID).disable();
|
||||
|
||||
// 更新保存按钮文本
|
||||
// F(btnSaveClientID).setText('保存数据(新增)');
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,286 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using BLL;
|
||||
|
||||
namespace FineUIPro.Web.BaseInfo
|
||||
{
|
||||
public partial class InstitutionalDivision : PageBase
|
||||
{
|
||||
#region 加载页面
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
////权限按钮方法
|
||||
this.GetButtonPower();
|
||||
Funs.DropDownPageSize(this.ddlPageSize);
|
||||
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
||||
// 绑定表格
|
||||
BindGrid();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绑定数据
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
var q = from x in Funs.DB.Base_InstitutionalDivision orderby x.Code select x;
|
||||
Grid1.RecordCount = q.Count();
|
||||
// 2.获取当前分页数据
|
||||
var table = GetPagedDataTable(Grid1.PageIndex, Grid1.PageSize);
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private List<Model.Base_InstitutionalDivision> GetPagedDataTable(int pageIndex, int pageSize)
|
||||
{
|
||||
List<Model.Base_InstitutionalDivision> source = (from x in Funs.DB.Base_InstitutionalDivision orderby x.Code select x).ToList();
|
||||
List<Model.Base_InstitutionalDivision> paged = new List<Model.Base_InstitutionalDivision>();
|
||||
|
||||
int rowbegin = pageIndex * pageSize;
|
||||
int rowend = (pageIndex + 1) * pageSize;
|
||||
if (rowend > source.Count())
|
||||
{
|
||||
rowend = source.Count();
|
||||
}
|
||||
|
||||
for (int i = rowbegin; i < rowend; i++)
|
||||
{
|
||||
paged.Add(source[i]);
|
||||
}
|
||||
|
||||
return paged;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 改变索引事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
||||
{
|
||||
Grid1.PageIndex = e.NewPageIndex;
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页下拉选择
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 过滤表头
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_FilterChange(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 删除
|
||||
/// <summary>
|
||||
/// 删除
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (judgementDelete(hfFormID.Text, true))
|
||||
{
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, this.txtCode.Text, hfFormID.Text, BLL.Const.InstitutionalDivisionMenuId, BLL.Const.BtnDelete);
|
||||
BLL.InstitutionalDivisionService.DeleteInstitutionalDivisionById(hfFormID.Text);
|
||||
|
||||
// 重新绑定表格,并模拟点击[新增按钮]
|
||||
BindGrid();
|
||||
PageContext.RegisterStartupScript("onNewButtonClick();");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 右键删除事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length > 0)
|
||||
{
|
||||
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
||||
{
|
||||
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
||||
if (judgementDelete(rowID, true))
|
||||
{
|
||||
var getV = BLL.InstitutionalDivisionService.GetInstitutionalDivisionById(rowID);
|
||||
if (getV != null)
|
||||
{
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, getV.Code, getV.Id, BLL.Const.InstitutionalDivisionMenuId, BLL.Const.BtnDelete);
|
||||
BLL.InstitutionalDivisionService.DeleteInstitutionalDivisionById(rowID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
PageContext.RegisterStartupScript("onNewButtonClick();");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断是否可删除
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="isShow"></param>
|
||||
/// <returns></returns>
|
||||
private bool judgementDelete(string id, bool isShow)
|
||||
{
|
||||
string content = string.Empty;
|
||||
if (Funs.DB.SitePerson_Person.FirstOrDefault(x => x.InstitutionalDivisionId == id) != null)
|
||||
{
|
||||
content = "该分类已在【人员信息】中使用,不能删除!";
|
||||
}
|
||||
if (string.IsNullOrEmpty(content))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isShow)
|
||||
{
|
||||
Alert.ShowInTop(content);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 编辑
|
||||
/// <summary>
|
||||
/// 右键编辑事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
Alert.ShowInTop("请至少选择一条记录!");
|
||||
return;
|
||||
}
|
||||
string Id = Grid1.SelectedRowID;
|
||||
var model= BLL.InstitutionalDivisionService.GetInstitutionalDivisionById(Id);
|
||||
if (model!= null)
|
||||
{
|
||||
this.txtCode.Text = model.Code;
|
||||
this.txtName.Text = model.Name;
|
||||
this.txtRemark.Text = model.Remark;
|
||||
hfFormID.Text = Id;
|
||||
this.btnDelete.Enabled = true;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存
|
||||
/// <summary>
|
||||
/// 保存按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
string strRowID = hfFormID.Text;
|
||||
Model.Base_InstitutionalDivision newInstitutionalDivision= new Model.Base_InstitutionalDivision
|
||||
{
|
||||
Code = this.txtCode.Text.Trim(),
|
||||
Name = this.txtName.Text.Trim(),
|
||||
Remark = txtRemark.Text.Trim()
|
||||
};
|
||||
if (string.IsNullOrEmpty(strRowID))
|
||||
{
|
||||
newInstitutionalDivision.Id = SQLHelper.GetNewID(typeof(Model.Base_InstitutionalDivision));
|
||||
BLL.InstitutionalDivisionService.AddInstitutionalDivision(newInstitutionalDivision);
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, newInstitutionalDivision.Code, newInstitutionalDivision.Id, BLL.Const.InstitutionalDivisionMenuId, BLL.Const.BtnAdd);
|
||||
}
|
||||
else
|
||||
{
|
||||
newInstitutionalDivision.Id = strRowID;
|
||||
BLL.InstitutionalDivisionService.UpdateInstitutionalDivision(newInstitutionalDivision);
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, newInstitutionalDivision.Code, newInstitutionalDivision.Id, BLL.Const.InstitutionalDivisionMenuId, BLL.Const.BtnModify);
|
||||
}
|
||||
this.SimpleForm1.Reset();
|
||||
// 重新绑定表格,并点击当前编辑或者新增的行
|
||||
BindGrid();
|
||||
PageContext.RegisterStartupScript(String.Format("F('{0}').selectRow('{1}');", Grid1.ClientID, newInstitutionalDivision.Id));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 验证职称信息名称、编号是否存在
|
||||
/// <summary>
|
||||
/// 验证职称信息名称、编号是否存在
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void TextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
var q = Funs.DB.Base_InstitutionalDivision.FirstOrDefault(x => x.Code == this.txtCode.Text.Trim() && (x.Id != hfFormID.Text || (hfFormID.Text == null && x.Id != null)));
|
||||
if (q != null)
|
||||
{
|
||||
ShowNotify("输入的职称编号已存在!", MessageBoxIcon.Warning);
|
||||
}
|
||||
|
||||
var q2 = Funs.DB.Base_InstitutionalDivision.FirstOrDefault(x => x.Name == this.txtName.Text.Trim() && (x.Id != hfFormID.Text || (hfFormID.Text == null && x.Id != null)));
|
||||
if (q2 != null)
|
||||
{
|
||||
ShowNotify("输入的职称名称已存在!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取按钮权限
|
||||
/// <summary>
|
||||
/// 获取按钮权限
|
||||
/// </summary>
|
||||
/// <param name="button"></param>
|
||||
/// <returns></returns>
|
||||
private void GetButtonPower()
|
||||
{
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.InstitutionalDivisionMenuId);
|
||||
if (buttonList.Count() > 0)
|
||||
{
|
||||
if (buttonList.Contains(BLL.Const.BtnAdd))
|
||||
{
|
||||
this.btnNew.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnModify))
|
||||
{
|
||||
this.btnMenuEdit.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnDelete))
|
||||
{
|
||||
this.btnDelete.Hidden = false;
|
||||
this.btnMenuDelete.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnSave))
|
||||
{
|
||||
this.btnSave.Hidden = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.BaseInfo
|
||||
{
|
||||
|
||||
|
||||
public partial class InstitutionalDivision
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
/// <summary>
|
||||
/// Panel1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel1;
|
||||
|
||||
/// <summary>
|
||||
/// Grid1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid Grid1;
|
||||
|
||||
/// <summary>
|
||||
/// Label1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label Label1;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarSeparator1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarText1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarText ToolbarText1;
|
||||
|
||||
/// <summary>
|
||||
/// ddlPageSize 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList ddlPageSize;
|
||||
|
||||
/// <summary>
|
||||
/// SimpleForm1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.SimpleForm SimpleForm1;
|
||||
|
||||
/// <summary>
|
||||
/// hfFormID 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.HiddenField hfFormID;
|
||||
|
||||
/// <summary>
|
||||
/// txtCode 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtCode;
|
||||
|
||||
/// <summary>
|
||||
/// txtName 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtName;
|
||||
|
||||
/// <summary>
|
||||
/// txtRemark 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextArea txtRemark;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar1;
|
||||
|
||||
/// <summary>
|
||||
/// btnNew 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnNew;
|
||||
|
||||
/// <summary>
|
||||
/// btnDelete 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnDelete;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarFill1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarFill ToolbarFill1;
|
||||
|
||||
/// <summary>
|
||||
/// btnSave 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSave;
|
||||
|
||||
/// <summary>
|
||||
/// Menu1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Menu Menu1;
|
||||
|
||||
/// <summary>
|
||||
/// btnMenuEdit 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.MenuButton btnMenuEdit;
|
||||
|
||||
/// <summary>
|
||||
/// btnMenuDelete 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.MenuButton btnMenuDelete;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -242,7 +242,10 @@
|
||||
<Content Include="BaseInfo\DesignProfessionalEdit.aspx" />
|
||||
<Content Include="BaseInfo\DesignProfessionalView.aspx" />
|
||||
<Content Include="BaseInfo\EmergencyType.aspx" />
|
||||
<Content Include="BaseInfo\InstitutionalDivision.aspx" />
|
||||
<Content Include="BaseInfo\EmployeeSubgroup.aspx" />
|
||||
<Content Include="BaseInfo\GoodsCategory.aspx" />
|
||||
<Content Include="BaseInfo\EmployeeCategory.aspx" />
|
||||
<Content Include="BaseInfo\RiskLevelEdit.aspx" />
|
||||
<Content Include="BaseInfo\RiskLevel.aspx" />
|
||||
<Content Include="BaseInfo\HazardRegisterTypes.aspx" />
|
||||
@@ -7758,6 +7761,20 @@
|
||||
<Compile Include="BaseInfo\EmergencyType.aspx.designer.cs">
|
||||
<DependentUpon>EmergencyType.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BaseInfo\InstitutionalDivision.aspx.cs">
|
||||
<DependentUpon>InstitutionalDivision.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="BaseInfo\InstitutionalDivision.aspx.designer.cs">
|
||||
<DependentUpon>InstitutionalDivision.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BaseInfo\EmployeeSubgroup.aspx.cs">
|
||||
<DependentUpon>EmployeeSubgroup.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="BaseInfo\EmployeeSubgroup.aspx.designer.cs">
|
||||
<DependentUpon>EmployeeSubgroup.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BaseInfo\GoodsCategory.aspx.cs">
|
||||
<DependentUpon>GoodsCategory.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
@@ -7765,6 +7782,13 @@
|
||||
<Compile Include="BaseInfo\GoodsCategory.aspx.designer.cs">
|
||||
<DependentUpon>GoodsCategory.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BaseInfo\EmployeeCategory.aspx.cs">
|
||||
<DependentUpon>EmployeeCategory.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="BaseInfo\EmployeeCategory.aspx.designer.cs">
|
||||
<DependentUpon>EmployeeCategory.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BaseInfo\RiskLevelEdit.aspx.cs">
|
||||
<DependentUpon>RiskLevelEdit.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
|
||||
@@ -63,8 +63,8 @@
|
||||
BLL.MonitorService.StartMonitor();
|
||||
BLL.MonitorService.StartWeather();
|
||||
BLL.MonitorService.StartMonitorEve();
|
||||
BLL.MonitorService.StartPersonQuarterCheck();
|
||||
BLL.MonitorService.StartEnvironmentSync();
|
||||
//BLL.MonitorService.StartPersonQuarterCheck();
|
||||
//BLL.MonitorService.StartEnvironmentSync();
|
||||
ErrLogInfo.WriteLog("通用定时器结束!");
|
||||
|
||||
}
|
||||
|
||||
@@ -142,6 +142,13 @@
|
||||
<f:RenderField Width="110px" ColumnID="CertificateCode" DataField="CertificateCode" SortField="CertificateCode"
|
||||
FieldType="String" HeaderText="证书编号" HeaderTextAlign="Center" TextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="120px" ColumnID="SendUnit" DataField="SendUnit" SortField="SendUnit"
|
||||
FieldType="String" HeaderText="发证单位" HeaderTextAlign="Center" TextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="100px" ColumnID="SendDate" DataField="SendDate" SortField="SendDate"
|
||||
FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd" HeaderText="发证日期"
|
||||
HeaderTextAlign="Center" TextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="100px" ColumnID="CertificateLimitTime" DataField="CertificateLimitTime" SortField="CertificateLimitTime"
|
||||
FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd" HeaderText="证书有效期"
|
||||
HeaderTextAlign="Center" TextAlign="Center">
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace FineUIPro.Web.HSSE.SitePerson
|
||||
oleDBConn.Close();
|
||||
oleDBConn.Dispose();
|
||||
|
||||
AddDatasetToSQL(ds.Tables[0], 36);
|
||||
AddDatasetToSQL(ds.Tables[0], 38);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -505,19 +505,6 @@ namespace FineUIPro.Web.HSSE.SitePerson
|
||||
}
|
||||
}
|
||||
|
||||
string col26 = pds.Rows[i][26].ToString().Trim();
|
||||
if (!string.IsNullOrEmpty(col26))
|
||||
{
|
||||
try
|
||||
{
|
||||
DateTime date = Convert.ToDateTime(col26);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += "第" + (i + 2).ToString() + "行," + "证书有效期" + "," + "[" + col26 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
|
||||
string col27 = pds.Rows[i][27].ToString().Trim();
|
||||
if (!string.IsNullOrEmpty(col27))
|
||||
{
|
||||
@@ -527,38 +514,45 @@ namespace FineUIPro.Web.HSSE.SitePerson
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += "第" + (i + 2).ToString() + "行," + "出生日期" + "," + "[" + col27 + "]错误!" + "|";
|
||||
result += "第" + (i + 2).ToString() + "行," + "发证日期" + "," + "[" + col27 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
|
||||
string col30 = pds.Rows[i][30].ToString().Trim();
|
||||
if (!string.IsNullOrEmpty(col30))
|
||||
string col28 = pds.Rows[i][28].ToString().Trim();
|
||||
if (!string.IsNullOrEmpty(col28))
|
||||
{
|
||||
try
|
||||
{
|
||||
DateTime date = Convert.ToDateTime(col30);
|
||||
DateTime date = Convert.ToDateTime(col28);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += "第" + (i + 2).ToString() + "行," + "出场时间" + "," + "[" + col30 + "]错误!" + "|";
|
||||
result += "第" + (i + 2).ToString() + "行," + "证书有效期" + "," + "[" + col28 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
|
||||
string col29 = pds.Rows[i][29].ToString().Trim();
|
||||
if (!string.IsNullOrEmpty(col29))
|
||||
{
|
||||
try
|
||||
{
|
||||
DateTime date = Convert.ToDateTime(col29);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += "第" + (i + 2).ToString() + "行," + "出生日期" + "," + "[" + col29 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
|
||||
string col32 = pds.Rows[i][32].ToString().Trim();
|
||||
if (!string.IsNullOrEmpty(col32))
|
||||
{
|
||||
if (col32 != "是" && col32 != "否")
|
||||
try
|
||||
{
|
||||
result += "第" + (i + 2).ToString() + "行," + "外籍" + "," + "[" + col32 + "]错误!" + "|";
|
||||
DateTime date = Convert.ToDateTime(col32);
|
||||
}
|
||||
}
|
||||
|
||||
string col33 = pds.Rows[i][33].ToString().Trim();
|
||||
if (!string.IsNullOrEmpty(col33))
|
||||
{
|
||||
if (col33 != "是" && col33 != "否")
|
||||
catch (Exception)
|
||||
{
|
||||
result += "第" + (i + 2).ToString() + "行," + "外聘" + "," + "[" + col33 + "]错误!" + "|";
|
||||
result += "第" + (i + 2).ToString() + "行," + "出场时间" + "," + "[" + col32 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -567,20 +561,38 @@ namespace FineUIPro.Web.HSSE.SitePerson
|
||||
{
|
||||
if (col34 != "是" && col34 != "否")
|
||||
{
|
||||
result += "第" + (i + 2).ToString() + "行," + "人员是否在场" + "," + "[" + col34 + "]错误!" + "|";
|
||||
result += "第" + (i + 2).ToString() + "行," + "外籍" + "," + "[" + col34 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result += "第" + (i + 2).ToString() + "行," + "人员是否在场" + "," + "此项为必填项!" + "|";
|
||||
}
|
||||
|
||||
string col35 = pds.Rows[i][35].ToString().Trim();
|
||||
if (!string.IsNullOrEmpty(col35))
|
||||
{
|
||||
if (col35 != "是" && col35 != "否")
|
||||
{
|
||||
result += "第" + (i + 2).ToString() + "行," + "考勤卡是否启用" + "," + "[" + col35 + "]错误!" + "|";
|
||||
result += "第" + (i + 2).ToString() + "行," + "外聘" + "," + "[" + col35 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
|
||||
string col36 = pds.Rows[i][36].ToString().Trim();
|
||||
if (!string.IsNullOrEmpty(col36))
|
||||
{
|
||||
if (col36 != "是" && col36 != "否")
|
||||
{
|
||||
result += "第" + (i + 2).ToString() + "行," + "人员是否在场" + "," + "[" + col36 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result += "第" + (i + 2).ToString() + "行," + "人员是否在场" + "," + "此项为必填项!" + "|";
|
||||
}
|
||||
|
||||
string col37 = pds.Rows[i][37].ToString().Trim();
|
||||
if (!string.IsNullOrEmpty(col37))
|
||||
{
|
||||
if (col37 != "是" && col37 != "否")
|
||||
{
|
||||
result += "第" + (i + 2).ToString() + "行," + "考勤卡是否启用" + "," + "[" + col37 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
//else
|
||||
@@ -682,7 +694,7 @@ namespace FineUIPro.Web.HSSE.SitePerson
|
||||
oleDBConn.Close();
|
||||
oleDBConn.Dispose();
|
||||
|
||||
AddDatasetToSQL2(ds.Tables[0], 36);
|
||||
AddDatasetToSQL2(ds.Tables[0], 38);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -772,6 +784,8 @@ namespace FineUIPro.Web.HSSE.SitePerson
|
||||
string col33 = pds.Rows[i][33].ToString().Trim();
|
||||
string col34 = pds.Rows[i][34].ToString().Trim();
|
||||
string col35 = pds.Rows[i][35].ToString().Trim();
|
||||
string col36 = pds.Rows[i][36].ToString().Trim();
|
||||
string col37 = pds.Rows[i][37].ToString().Trim();
|
||||
|
||||
if (!string.IsNullOrEmpty(col0))//卡号
|
||||
{
|
||||
@@ -972,47 +986,55 @@ namespace FineUIPro.Web.HSSE.SitePerson
|
||||
{
|
||||
personQuality.CertificateNo = col25;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(col26))//证书有效期
|
||||
if (!string.IsNullOrEmpty(col26))//发证单位
|
||||
{
|
||||
personQuality.LimitDate = Funs.GetNewDateTime(col26);
|
||||
personQuality.SendUnit = col26;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(col27))//出生日期
|
||||
if (!string.IsNullOrEmpty(col27))//发证日期
|
||||
{
|
||||
person.Birthday = Funs.GetNewDateTime(col27);
|
||||
personQuality.SendDate = Funs.GetNewDateTime(col27);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(col28))//电话
|
||||
if (!string.IsNullOrEmpty(col28))//证书有效期
|
||||
{
|
||||
person.Telephone = col28;
|
||||
personQuality.LimitDate = Funs.GetNewDateTime(col28);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(col29))//家庭地址
|
||||
if (!string.IsNullOrEmpty(col29))//出生日期
|
||||
{
|
||||
person.Address = col29;
|
||||
person.Birthday = Funs.GetNewDateTime(col29);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(col30))//出场时间
|
||||
if (!string.IsNullOrEmpty(col30))//电话
|
||||
{
|
||||
person.OutTime = Funs.GetNewDateTime(col30);
|
||||
person.Telephone = col30;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(col31))//出场原因
|
||||
if (!string.IsNullOrEmpty(col31))//家庭地址
|
||||
{
|
||||
person.OutResult = col31;
|
||||
person.Address = col31;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(col32))//外籍
|
||||
if (!string.IsNullOrEmpty(col32))//出场时间
|
||||
{
|
||||
person.IsForeignStr = col32;
|
||||
person.IsForeign = col32 == "是" ? true : false;
|
||||
person.OutTime = Funs.GetNewDateTime(col32);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(col33))//外聘
|
||||
if (!string.IsNullOrEmpty(col33))//出场原因
|
||||
{
|
||||
person.IsOutsideStr = col33;
|
||||
person.IsOutside = col33 == "是" ? true : false;
|
||||
person.OutResult = col33;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(col34))//人员是否在场
|
||||
if (!string.IsNullOrEmpty(col34))//外籍
|
||||
{
|
||||
person.IsUsedName = col34;
|
||||
person.IsForeignStr = col34;
|
||||
person.IsForeign = col34 == "是" ? true : false;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(col35))//考勤卡是否启用
|
||||
if (!string.IsNullOrEmpty(col35))//外聘
|
||||
{
|
||||
person.IsCardUsedName = col35;
|
||||
person.IsOutsideStr = col35;
|
||||
person.IsOutside = col35 == "是" ? true : false;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(col36))//人员是否在场
|
||||
{
|
||||
person.IsUsedName = col36;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(col37))//考勤卡是否启用
|
||||
{
|
||||
person.IsCardUsedName = col37;
|
||||
}
|
||||
person.PersonId = SQLHelper.GetNewID(typeof(Model.SitePerson_Person));
|
||||
persons.Add(person);
|
||||
@@ -1197,6 +1219,8 @@ namespace FineUIPro.Web.HSSE.SitePerson
|
||||
}
|
||||
newPersonQuality.CertificateName = item.CertificateName;
|
||||
newPersonQuality.CertificateNo = item.CertificateNo;
|
||||
newPersonQuality.SendUnit = item.SendUnit;
|
||||
newPersonQuality.SendDate = item.SendDate;
|
||||
newPersonQuality.LimitDate = item.LimitDate;
|
||||
BLL.PersonQualityService.AddPersonQuality(newPersonQuality);
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
<f:Panel ID="Panel4" runat="server" BoxFlex="3" ShowBorder="false" ShowHeader="false"
|
||||
MarginRight="5px" Layout="VBox">
|
||||
<Items>
|
||||
<f:TextBox ID="txtCardNo" runat="server" Label="卡号" MaxLength="50"
|
||||
<f:TextBox ID="txtCardNo" runat="server" Label="员工号" MaxLength="50"
|
||||
LabelAlign="Right" AutoPostBack="true" OnTextChanged="TextBox_TextChanged">
|
||||
</f:TextBox>
|
||||
<f:Button runat="server" ID="btnReadIdentityCard" Icon="Vcard" OnClick="btnReadIdentityCard_Click"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
|
||||
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" Title="部门信息" Layout="HBox" ShowHeader="false">
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" Title="部门信息" ShowHeader="false" EnableCollapse="true" PageSize="10"
|
||||
<f:Grid ID="Grid1" Title="部门信息" ShowHeader="false" EnableCollapse="true" PageSize="20"
|
||||
ShowBorder="true" AllowPaging="true" IsDatabasePaging="true" runat="server" Width="760px"
|
||||
DataKeyNames="DepartId" DataIDField="DepartId" OnPageIndexChange="Grid1_PageIndexChange"
|
||||
AllowFilters="true" OnFilterChange="Grid1_FilterChange" EnableTextSelection="True" EnableColumnLines="true">
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
runat="server" BoxFlex="1" DataKeyNames="RoleId" AllowCellEditing="true" EnableColumnLines="true"
|
||||
ClicksToEdit="2" DataIDField="RoleId" AllowSorting="true" SortField="RoleCode"
|
||||
SortDirection="ASC" OnSort="Grid1_Sort" AllowPaging="true" IsDatabasePaging="true"
|
||||
PageSize="10" OnPageIndexChange="Grid1_PageIndexChange" ForceFit="true"
|
||||
PageSize="20" OnPageIndexChange="Grid1_PageIndexChange" ForceFit="true"
|
||||
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar2" Position="Top" runat="server">
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
runat="server" BoxFlex="1" DataKeyNames="UnitId" AllowCellEditing="true" EnableColumnLines="true"
|
||||
ClicksToEdit="2" DataIDField="UnitId" AllowSorting="true" SortField="UnitCode"
|
||||
SortDirection="ASC" OnSort="Grid1_Sort" AllowPaging="true" IsDatabasePaging="true"
|
||||
PageSize="10" OnPageIndexChange="Grid1_PageIndexChange" ForceFit="true"
|
||||
PageSize="20" OnPageIndexChange="Grid1_PageIndexChange" ForceFit="true"
|
||||
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick"
|
||||
EnableTextSelection="True">
|
||||
<Toolbars>
|
||||
|
||||
@@ -20,59 +20,61 @@
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="用户信息" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" DataKeyNames="UserId" AllowCellEditing="true" EnableColumnLines="true"
|
||||
ClicksToEdit="2" DataIDField="UserId" AllowSorting="true" SortField="UnitName,UserName" ForceFit="true"
|
||||
ClicksToEdit="2" DataIDField="UserId" AllowSorting="true" SortField="UnitName,UserCode" ForceFit="true"
|
||||
SortDirection="ASC" OnSort="Grid1_Sort" AllowPaging="true" IsDatabasePaging="true"
|
||||
PageSize="10" OnPageIndexChange="Grid1_PageIndexChange" EnableRowDoubleClickEvent="true"
|
||||
OnRowDoubleClick="Grid1_RowDoubleClick" Width="980px" EnableTextSelection="True">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar2" Position="Top" runat="server">
|
||||
<Items>
|
||||
<Items>
|
||||
<f:TextBox runat="server" Label="姓名" ID="txtUserName" EmptyText="输入查询条件" AutoPostBack="true"
|
||||
OnTextChanged="TextBox_TextChanged" Width="210px" LabelWidth="50px">
|
||||
</f:TextBox>
|
||||
<f:DropDownList ID="drpUnit" runat="server" Label="单位" EnableEdit="true" AutoPostBack="true"
|
||||
OnSelectedIndexChanged="TextBox_TextChanged" LabelWidth="50px">
|
||||
</f:DropDownList>
|
||||
</f:DropDownList>
|
||||
<f:DropDownList ID="drpDepart" runat="server" Label="部门" AutoPostBack="true" OnSelectedIndexChanged="TextBox_TextChanged"
|
||||
EnableEdit="true" Width="190px" LabelWidth="50px">
|
||||
</f:DropDownList>
|
||||
EnableEdit="true" Width="190px" LabelWidth="50px">
|
||||
</f:DropDownList>
|
||||
<f:DropDownList ID="drpRole" runat="server" Label="角色" EnableEdit="true" AutoPostBack="true"
|
||||
OnSelectedIndexChanged="TextBox_TextChanged" LabelWidth="50px">
|
||||
</f:DropDownList>
|
||||
</f:DropDownList>
|
||||
<f:ToolbarFill runat="server">
|
||||
</f:ToolbarFill>
|
||||
<f:Button ID="btnNew" ToolTip="新增" Icon="Add" EnablePostBack="false" runat="server"
|
||||
Hidden="true">
|
||||
</f:Button>
|
||||
<f:Button ID="btnImport" ToolTip="导入" Icon="ApplicationAdd" Hidden="true" runat="server"
|
||||
OnClick="btnImport_Click">
|
||||
OnClick="btnImport_Click">
|
||||
</f:Button>
|
||||
|
||||
|
||||
<%--<f:Button ID="Button1" OnClick="btnImport1_Click" runat="server" Text="从主数据平台同步" ToolTip="从主数据平台同步" Icon="ApplicationGet" >
|
||||
</f:Button>--%>
|
||||
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<Columns>
|
||||
<f:RowNumberField EnablePagingNumber="true" HeaderText="序号" Width="45px" HeaderTextAlign="Center"
|
||||
TextAlign="Center" />
|
||||
<f:RenderField Width="100px" ColumnID="UserCode" DataField="UserCode" SortField="UserCode"
|
||||
FieldType="String" HeaderText="员工编号" HeaderTextAlign="Center" TextAlign="Left">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="100px" ColumnID="UserName" DataField="UserName" SortField="UserName"
|
||||
FieldType="String" HeaderText="姓名" HeaderTextAlign="Center" TextAlign="Left">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="230px" ColumnID="UnitName" DataField="UnitName" SortField="UnitName"
|
||||
FieldType="String" HeaderText="单位名称" HeaderTextAlign="Center" TextAlign="Left" >
|
||||
FieldType="String" HeaderText="单位名称" HeaderTextAlign="Center" TextAlign="Left">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="100px" ColumnID="UnitCode" DataField="UnitCode" SortField="UnitCode"
|
||||
FieldType="String" HeaderText="单位编号" HeaderTextAlign="Center" TextAlign="Left" >
|
||||
FieldType="String" HeaderText="单位编号" HeaderTextAlign="Center" TextAlign="Left">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="100px" ColumnID="DepartName" DataField="DepartName" SortField="DepartName"
|
||||
FieldType="String" HeaderText="部门" HeaderTextAlign="Center" TextAlign="Left" >
|
||||
FieldType="String" HeaderText="部门" HeaderTextAlign="Center" TextAlign="Left">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="110px" ColumnID="Account" DataField="Account" SortField="Account"
|
||||
FieldType="String" HeaderText="账号" HeaderTextAlign="Center" TextAlign="Left">
|
||||
</f:RenderField>
|
||||
<%-- <f:RenderField Width="120px" ColumnID="IdentityCard" DataField="IdentityCard" SortField="IdentityCard"
|
||||
<%-- <f:RenderField Width="120px" ColumnID="IdentityCard" DataField="IdentityCard" SortField="IdentityCard"
|
||||
FieldType="String" HeaderText="身份证号码" HeaderTextAlign="Center" TextAlign="Right" Hidden="true">
|
||||
</f:RenderField>--%>
|
||||
<f:RenderField Width="150px" ColumnID="RoleName" DataField="RoleName" SortField="RoleName"
|
||||
@@ -84,7 +86,7 @@
|
||||
<f:CheckBoxField Width="60px" SortField="IsPost" RenderAsStaticField="true" DataField="IsPost"
|
||||
HeaderText="在岗" HeaderTextAlign="Center" TextAlign="Center">
|
||||
</f:CheckBoxField>
|
||||
<%-- <f:CheckBoxField Width="50px" SortField="IsOffice" RenderAsStaticField="true" DataField="IsOffice"
|
||||
<%-- <f:CheckBoxField Width="50px" SortField="IsOffice" RenderAsStaticField="true" DataField="IsOffice"
|
||||
HeaderText="本部" HeaderTextAlign="Center" TextAlign="Center">
|
||||
</f:CheckBoxField>--%>
|
||||
<f:TemplateField Width="200px" ColumnID="UserId" HeaderText="参与项目" TextAlign="Left">
|
||||
@@ -102,7 +104,7 @@
|
||||
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
|
||||
</f:ToolbarText>
|
||||
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
|
||||
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
|
||||
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
|
||||
</f:DropDownList>
|
||||
</PageItems>
|
||||
</f:Grid>
|
||||
@@ -115,7 +117,7 @@
|
||||
<f:Window ID="Window2" Title="导入人员信息" Hidden="true" EnableIFrame="true" EnableMaximize="true"
|
||||
Target="Parent" EnableResize="false" runat="server" OnClose="Window2_Close" IsModal="false"
|
||||
CloseAction="HidePostBack" Width="1000px" Height="560px">
|
||||
</f:Window>
|
||||
</f:Window>
|
||||
<f:Menu ID="Menu1" runat="server">
|
||||
<f:MenuButton ID="btnMenuEdit" OnClick="btnMenuEdit_Click" EnablePostBack="true"
|
||||
Hidden="true" runat="server" Text="编辑" Icon="Pencil">
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<Rows>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:TextBox ID="txtUserCode" runat="server" Label="编号" MaxLength="20" LabelWidth="90px">
|
||||
<f:TextBox ID="txtUserCode" runat="server" Label="员工编号" MaxLength="20" LabelWidth="90px">
|
||||
</f:TextBox>
|
||||
<f:TextBox ID="txtUserName" runat="server" Label="姓名" Required="true" ShowRedStar="true" MaxLength="20"
|
||||
FocusOnPageLoad="true" LabelWidth="90px">
|
||||
|
||||
Reference in New Issue
Block a user