using BWP.B3ClientService.BO;
|
|
using System;
|
|
using System.Web.UI.HtmlControls;
|
|
using System.Web.UI.WebControls;
|
|
using TSingSoft.WebControls2;
|
|
using TSingSoft.WebPluginFramework.Controls;
|
|
using TSingSoft.WebPluginFramework.Pages;
|
|
using Forks.EnterpriseServices.DomainObjects2;
|
|
using Forks.EnterpriseServices.DomainObjects2.DQuery;
|
|
using TSingSoft.WebPluginFramework;
|
|
using BWP.B3ClientService.Tasks;
|
|
|
|
namespace BWP.Web.Pages.B3ClientService
|
|
{
|
|
class ServerHostConfig : ServerPage
|
|
{
|
|
DFTextBox serverUrlInput;
|
|
protected override void InitForm(HtmlForm form)
|
|
{
|
|
form.Controls.Add(new PageTitle("服务器地址配置"));
|
|
var hPanel = new HLayoutPanel();
|
|
form.Controls.Add(hPanel);
|
|
|
|
hPanel.Add(new SimpleLabel("地址"));
|
|
serverUrlInput = hPanel.Add(new DFTextBox() { Width = Unit.Pixel(300) });
|
|
hPanel.Add(new TSButton("保存", delegate
|
|
{
|
|
if (serverUrlInput.IsEmpty)
|
|
throw new Exception("地址不能为空");
|
|
using (var session = Dmo.NewSession())
|
|
{
|
|
var entity = new ServerHost() { ServerUrl = serverUrlInput.Text.Trim() };
|
|
if (Exist())
|
|
session.Update(entity);
|
|
else
|
|
session.Insert(entity);
|
|
session.Commit();
|
|
}
|
|
AspUtil.Alert(this, "保存成功!");
|
|
|
|
}));
|
|
}
|
|
|
|
bool Exist()
|
|
{
|
|
var query = new DQueryDom(new JoinAlias(typeof(ServerHost)));
|
|
return query.EExists();
|
|
}
|
|
|
|
protected override void OnLoad(EventArgs e)
|
|
{
|
|
base.OnLoad(e);
|
|
if (!IsPostBack)
|
|
{
|
|
serverUrlInput.Text = ServerHost.GetServerUrl();
|
|
}
|
|
}
|
|
}
|
|
}
|