feat(hjgl): 新增防腐等级字典管理
将防腐等级维护纳入焊接设置菜单,便于统一维护防腐等级编码并复用系统权限配置。
This commit is contained in:
@@ -0,0 +1,170 @@
|
||||
using BLL;
|
||||
using System;
|
||||
|
||||
namespace FineUIPro.Web.HJGL.BaseInfo
|
||||
{
|
||||
public partial class PaintCodeDict : PageBase
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
Funs.DropDownPageSize(ddlPageSize);
|
||||
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
||||
BindGrid();
|
||||
}
|
||||
}
|
||||
|
||||
private void BindGrid()
|
||||
{
|
||||
var list = PaintCodeDictService.GetList(txtPaintCode.Text.Trim());
|
||||
Grid1.RecordCount = list.Count;
|
||||
Grid1.DataSource = GetPagedDataTable(Grid1, list);
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
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, GridSortEventArgs e)
|
||||
{
|
||||
Grid1.SortField = e.SortField;
|
||||
Grid1.SortDirection = e.SortDirection;
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
protected void btnQuery_Click(object sender, EventArgs e)
|
||||
{
|
||||
Grid1.PageIndex = 0;
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
protected void btnNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!GetButtonPower(Const.BtnAdd))
|
||||
{
|
||||
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference("PaintCodeDictEdit.aspx"));
|
||||
}
|
||||
|
||||
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
||||
{
|
||||
EditData();
|
||||
}
|
||||
|
||||
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
EditData();
|
||||
}
|
||||
|
||||
private void EditData()
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetButtonPower(Const.BtnModify))
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(
|
||||
string.Format("PaintCodeDictEdit.aspx?Id={0}", Grid1.SelectedRowID)));
|
||||
}
|
||||
else if (GetButtonPower(Const.BtnSee))
|
||||
{
|
||||
ShowView();
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!GetButtonPower(Const.BtnDelete))
|
||||
{
|
||||
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
string warning = string.Empty;
|
||||
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
||||
{
|
||||
string id = Grid1.DataKeys[rowIndex][0].ToString();
|
||||
var model = PaintCodeDictService.GetById(id);
|
||||
string restriction = PaintCodeDictService.GetDeleteRestriction(id);
|
||||
if (string.IsNullOrEmpty(restriction))
|
||||
{
|
||||
PaintCodeDictService.Delete(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
warning += "防腐等级:" + model.PaintCode + restriction;
|
||||
}
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
if (string.IsNullOrEmpty(warning))
|
||||
{
|
||||
ShowNotify("删除成功!", MessageBoxIcon.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop(warning, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnView_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GetButtonPower(Const.BtnSee))
|
||||
{
|
||||
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
ShowView();
|
||||
}
|
||||
|
||||
private void ShowView()
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(
|
||||
string.Format("PaintCodeDictView.aspx?Id={0}", Grid1.SelectedRowID)));
|
||||
}
|
||||
|
||||
protected void Window1_Close(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
private bool GetButtonPower(string button)
|
||||
{
|
||||
return CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, CurrUser.PersonId,
|
||||
Const.HJGL_PaintCodeDictMenuId, button);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user