xinjiang/SGGL/FineUIPro.Web/TestRun/DriverRun/DriverRunContactEdit.aspx.cs

107 lines
4.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using BLL;
using System;
namespace FineUIPro.Web.TestRun.DriverRun
{
public partial class DriverRunContactEdit :PageBase
{
#region
/// <summary>
/// 页面加载
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BLL.UnitService.InitUnitDownList(this.drpUnitId, this.CurrUser.LoginProjectId, true);
string id = Request.Params["id"];
if (!string.IsNullOrEmpty(id))
{
Model.DriverRun_DriverRunContact data = BLL.DriverRunContactService.GetDriverRunContactById(id);
if (data != null)
{
this.hdId.Text = id;
this.txtCode.Text = data.Code;
if (!string.IsNullOrEmpty(data.UnitId))
{
this.drpUnitId.SelectedValue = data.UnitId;
}
this.txtContact.Text = data.Contact;
this.txtHeadMan.Text = data.HeadMan;
this.txtContents.Text = data.Contents;
this.txtResultDef.Text = data.ResultDef;
this.txtRemark.Text = data.Remark;
}
}
}
}
#endregion
#region
/// <summary>
/// 附件上传
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAttach_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.hdId.Text)) //新增记录
{
this.hdId.Text = SQLHelper.GetNewID(typeof(Model.DriverRun_DriverRunContact));
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/TestRun/DriverRun/DriverRunContact&menuId={1}", this.hdId.Text, BLL.Const.DriverRunContactMenuId)));
}
#endregion
#region
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
if (this.drpUnitId.SelectedValue == BLL.Const._Null)
{
Alert.ShowInTop("", MessageBoxIcon.Warning);
return;
}
string id = Request.Params["id"];
Model.DriverRun_DriverRunContact newData = new Model.DriverRun_DriverRunContact();
newData.Code = this.txtCode.Text.Trim();
if (this.drpUnitId.SelectedValue != BLL.Const._Null)
{
newData.UnitId = this.drpUnitId.SelectedValue;
}
newData.Contact = this.txtContact.Text.Trim();
newData.HeadMan = this.txtHeadMan.Text.Trim();
newData.Contents = this.txtContents.Text.Trim();
newData.ResultDef = this.txtResultDef.Text.Trim();
newData.Remark = this.txtRemark.Text.Trim();
newData.ProjectId = this.CurrUser.LoginProjectId;
if (!string.IsNullOrEmpty(id))
{
newData.DriverRunContactId = id;
BLL.DriverRunContactService.UpdateDriverRunContact(newData);
}
else
{
if (!string.IsNullOrEmpty(this.hdId.Text))
{
newData.DriverRunContactId = this.hdId.Text.Trim();
}
else
{
newData.DriverRunContactId = SQLHelper.GetNewID(typeof(Model.DriverRun_DriverRunContact));
this.hdId.Text = newData.DriverRunContactId;
}
BLL.DriverRunContactService.AddDriverRunContact(newData);
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
#endregion
}
}