屠宰场管理服务
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.1 KiB

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, traceServerUrlInput;
protected override void InitForm(HtmlForm form)
{
form.Controls.Add(new PageTitle("服务器地址配置"));
var vPanel=new VLayoutPanel();
form.Controls.Add(vPanel);
var hPanel = new HLayoutPanel();
vPanel.Add(hPanel);
hPanel.Add(new SimpleLabel("B3服务器地址"));
serverUrlInput = hPanel.Add(new DFTextBox() { Width = Unit.Pixel(300) });
var hPanel1 = new HLayoutPanel();
vPanel.Add(hPanel1);
hPanel1.Add(new SimpleLabel("追溯服务器地址"));
traceServerUrlInput = hPanel1.Add(new DFTextBox() { Width = Unit.Pixel(300) });
var hPane2 = new HLayoutPanel();
vPanel.Add(hPane2);
hPane2.Add(new TSButton("保存", delegate
{
if (serverUrlInput.IsEmpty)
throw new Exception("地址不能为空");
using (var session = Dmo.NewSession())
{
var entity = new ServerHost() { ServerUrl = serverUrlInput.Text.Trim() ,TraceServerUrl = traceServerUrlInput.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();
traceServerUrlInput.Text = ServerHost.GetTraceServerUrl();
}
}
}
}