using FineUIPro;
|
using FineUIPro.iWareWms;
|
using iWareCommon.Common.Entity;
|
using iWareDataCore.RBAC.Entity;
|
using iWareDataCore.RBAC.EnumType;
|
using iWareDataCore.RBAC.Service;
|
using System;
|
using System.Collections.Generic;
|
using System.Web.UI.WebControls;
|
|
namespace iWareWms.View.RBAC.Content
|
{
|
/// <summary>
|
/// 许艺潇
|
/// 2018.06
|
/// 菜单添加操作页面(弹窗)
|
/// </summary>
|
public partial class ContentDetail : PageBase
|
{
|
|
protected override void Save(out string msg)
|
{
|
ContentService.GetInstance().Save(GetContent(), out msg);
|
}
|
|
protected override void Update(out string msg)
|
{
|
|
var content = GetContent();
|
content.Id = Convert.ToInt32(Request.QueryString["Id"]);
|
|
ContentService.GetInstance().Update(content, out msg);
|
}
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
if (!IsPostBack)
|
{
|
foreach(var type in Enum.GetValues(typeof(EContentType)))
|
{
|
this.Type.Items.Add(type.ToString(), ((int)type).ToString());
|
}
|
|
//新增
|
if (string.IsNullOrEmpty(Request.QueryString["IsEdit"]))
|
{
|
DropDownBox1.Value = (-1).ToString();
|
return;
|
}
|
|
string msg;
|
|
//修改
|
var contents = ContentService.GetInstance().QueryByParam(new QueryParam { Filter = new Dictionary<string, object> { { "Id", Request.QueryString["Id"] } } }, out msg);
|
|
if (!string.IsNullOrEmpty(msg))
|
{
|
Alert.ShowInTop(msg);
|
return;
|
}
|
|
DropDownBox1.Value = contents[0].ParentId.ToString();
|
Name.Text = contents[0].Name;
|
ContentIndex.Text = contents[0].ContentIndex.ToString();
|
Url.Text = contents[0].Url;
|
Image.Text = contents[0].Image;
|
Remark.Text = contents[0].Remark;
|
Type.SelectedValue = contents[0].Type.ToString();
|
}
|
}
|
|
private ContentEntity GetContent()
|
{
|
return new ContentEntity
|
{
|
|
Name = Name.Text.Trim(),
|
Url = Url.Text.Trim(),
|
Image = Image.Text.Trim(),
|
ParentId = Convert.ToInt32(DropDownBox1.Value),
|
Type = Convert.ToInt32(Type.SelectedValue.Trim()),
|
Remark = Remark.Text.Trim(),
|
ContentIndex = Convert.ToInt32(ContentIndex.Text.Trim())
|
};
|
}
|
}
|
}
|