using BLL;
using System;
using System.Linq;
namespace FineUIPro.Web.HJGL.PreDesign
{
public partial class TrainNumberManageEdit
: PageBase
{
#region
///
/// 主键
///
public string Id
{
get
{
return (string)ViewState["Id"];
}
set
{
ViewState["Id"] = value;
}
}
#endregion
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
////权限按钮方法
this.GetButtonPower();
this.Id = Request.Params["Id"];
if (!string.IsNullOrEmpty(this.Id))
{
Model.HJGL_TrainNumberManage model = BLL.TrainNumberManageService.GetModelById(this.Id);
if (model != null)
{
this.txtTrainNumber.Text = model.TrainNumber;
this.txtDriverName.Text = model.DriverName;
this.txtDriverPhone.Text = model.DriverPhone;
this.txtLicensePlateNumber.Text = model.LicensePlateNumber;
this.txtContactName.Text = model.ContactName;
this.txtContactPhone.Text = model.ContactPhone;
this.txtRemark.Text = model.Remark;
}
}
else
{
this.txtTrainNumber.Text = TrainNumberManageService.GetNewTrainNumber(this.CurrUser.LoginProjectId);
}
}
}
///
/// 保存按钮
///
///
///
protected void btnSave_Click(object sender, EventArgs e)
{
Model.HJGL_TrainNumberManage table = new Model.HJGL_TrainNumberManage();
table.TrainNumber = this.txtTrainNumber.Text;
table.ProjectId = this.CurrUser.LoginProjectId;
table.State = 0;
table.DriverName = this.txtDriverName.Text;
table.DriverPhone = this.txtDriverPhone.Text;
table.LicensePlateNumber = this.txtLicensePlateNumber.Text;
table.ContactName = this.txtContactName.Text;
table.ContactPhone = this.txtContactPhone.Text;
table.Remark = this.txtRemark.Text;
if (string.IsNullOrEmpty(this.Id))
{
table.Id = SQLHelper.GetNewID(typeof(Model.HJGL_TrainNumberManage));
BLL.TrainNumberManageService.Add(table);
}
else
{
table.Id = this.Id;
BLL.TrainNumberManageService.Update(table);
}
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
}
#region 获取按钮权限
///
/// 获取按钮权限
///
///
///
private void GetButtonPower()
{
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.HJGL_TrainNumberManageMenuId);
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnSave))
{
this.btnSave.Hidden = false;
}
}
}
#endregion
}
}