using FineUIPro;
|
using FineUIPro.iWareWms;
|
using iWareCommon.Common.Entity;
|
using iWareDataCore.RBAC.EnumType;
|
using iWareDataCore.RBAC.Service;
|
using System;
|
using System.Collections.Generic;
|
|
namespace iWareWms.View.RBAC.Content
|
{
|
/// <summary>
|
/// 许艺潇
|
/// 2018.06
|
/// 菜单管理操作页面(弹窗)
|
/// </summary>
|
public partial class Content : PageBase
|
{
|
protected override Grid GetGrid()
|
{
|
return Grid1;
|
}
|
|
protected override void Delete(int id, out string msg)
|
{
|
ContentService.GetInstance().Delete(id, out msg);
|
}
|
|
protected override List<object> GetDataSource(out string msg)
|
{
|
var contents = ContentService.GetInstance().QueryByParam(new QueryParam
|
{
|
Order = new Dictionary<string, object> { { "Type", "ASC" }, { "ContentIndex", "ASC" } }
|
}, out msg);
|
var res = new List<object>();
|
contents.ForEach(x => res.Add(x));
|
return res;
|
}
|
|
protected override void GridRowCommand(object sender, GridCommandEventArgs e)
|
{
|
var grid = GetGrid();
|
|
if (grid == null)
|
{
|
return;
|
|
}
|
if (e.CommandName == "Delete")
|
{
|
string msg;
|
|
Delete(Convert.ToInt32((grid.DataKeys[e.RowIndex][0].ToString())), out msg);
|
Alert.ShowInTop(string.IsNullOrEmpty(msg) ? "删除成功" : msg);
|
|
if (string.IsNullOrEmpty(msg))
|
{
|
|
Query();
|
}
|
}
|
}
|
|
protected override void WindowClose(object sender, EventArgs e)
|
{
|
Query();
|
}
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
if (!IsPostBack)
|
{
|
btnNew.OnClientClick = Window1.GetShowReference("~/View/RBAC/Content/ContentDetail.aspx", "新增菜单");
|
Query();
|
}
|
}
|
|
protected void btnBS_Click(object sender, EventArgs e)
|
{
|
SetSelectedContentType((int)EContentType.用于BS端的菜单);
|
}
|
|
protected void btnCS_Click(object sender, EventArgs e)
|
{
|
SetSelectedContentType((int)EContentType.用于CS端的菜单);
|
}
|
|
protected void btnAll_Click(object sender, EventArgs e)
|
{
|
Query();
|
}
|
|
|
private void SetSelectedContentType(int type)
|
{
|
try
|
{
|
string msg;
|
var contents = ContentService.GetInstance().QueryByParam(new QueryParam
|
{
|
Filter = new Dictionary<string, object> { { "Type", type }},
|
Order = new Dictionary<string, object> { {"Type","ASC"},{ "ContentIndex", "ASC" } }
|
}, out msg);
|
if (string.IsNullOrEmpty(msg))
|
{
|
Grid1.DataSource = contents;
|
Grid1.DataBind();
|
}
|
else
|
{
|
Alert.ShowInTop(msg + "查询失败");
|
}
|
}
|
catch (Exception ex)
|
{
|
Alert.ShowInTop(ex.Message);
|
}
|
}
|
|
|
|
|
|
/// <summary>
|
/// 改变contentType显示信息
|
/// </summary>
|
/// <param name="workLabel"></param>
|
/// <returns></returns>
|
protected string GetContentType(object contentType)
|
{
|
return ((EContentType)contentType).ToString();
|
}
|
|
|
|
|
|
}
|
}
|