109 lines
3.6 KiB
C#
109 lines
3.6 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Linq;
|
|
|
|
namespace FineUIPro.Web.HJGL.PreDesign
|
|
{
|
|
public partial class TrainNumberManageEdit
|
|
|
|
: PageBase
|
|
{
|
|
#region
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 保存按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
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 获取按钮权限
|
|
/// <summary>
|
|
/// 获取按钮权限
|
|
/// </summary>
|
|
/// <param name="button"></param>
|
|
/// <returns></returns>
|
|
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
|
|
|
|
}
|
|
} |