SGGL_SHJ/SGGL/FineUIPro.Web/HJGL/PreDesign/TrainNumberManageEdit.aspx.cs

114 lines
3.7 KiB
C#

using BLL;
using Org.BouncyCastle.Asn1.Ocsp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
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
}
}