119 lines
4.2 KiB
C#
119 lines
4.2 KiB
C#
using BLL;
|
|
using System;
|
|
|
|
namespace FineUIPro.Web.TestRun.DriverSub
|
|
{
|
|
public partial class DriverSubPlanEdit :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.drpSubUnitId, this.CurrUser.LoginProjectId, true);
|
|
//BLL.UnitWorkService.InitUnitWorkDropDownList(this.drpUnitWorkIds, this.CurrUser.LoginProjectId, true);
|
|
string id = Request.Params["id"];
|
|
SubcontractingTypes.DataSource=DropListService.drpDriverSubNameList();
|
|
SubcontractingTypes.DataTextField = "Text";
|
|
SubcontractingTypes.DataValueField = "Value";
|
|
SubcontractingTypes.DataBind();
|
|
|
|
|
|
if (!string.IsNullOrEmpty(id))
|
|
{
|
|
Model.DriverSub_DriverSubPlan data = BLL.DriverSubPlanService.GetDriverSubPlanById(id);
|
|
if (data != null)
|
|
{
|
|
this.hdId.Text = id;
|
|
this.txtCode.Text = data.Code;
|
|
this.SubcontractingTypes.SelectedValueArray= data.SubcontractingTypes.Split(',');
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#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.DriverSub_DriverSubPlan));
|
|
}
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/TestRun/DriverSub/DriverSubPlan&menuId={1}", this.hdId.Text, BLL.Const.DriverSubPlanMenuId)));
|
|
}
|
|
#endregion
|
|
|
|
#region 保存
|
|
/// <summary>
|
|
/// 保存按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
string id = Request.Params["id"];
|
|
Model.DriverSub_DriverSubPlan newData = new Model.DriverSub_DriverSubPlan();
|
|
newData.Code = this.txtCode.Text.Trim();
|
|
newData.SubcontractingTypes = GetStringByArray(this.SubcontractingTypes.SelectedValueArray);
|
|
newData.ProjectId = this.CurrUser.LoginProjectId;
|
|
if (!string.IsNullOrEmpty(id))
|
|
{
|
|
newData.DriverSubPlanId = id;
|
|
BLL.DriverSubPlanService.UpdateDriverSubPlan(newData);
|
|
}
|
|
else
|
|
{
|
|
if (!string.IsNullOrEmpty(this.hdId.Text))
|
|
{
|
|
newData.DriverSubPlanId = this.hdId.Text.Trim();
|
|
}
|
|
else
|
|
{
|
|
newData.DriverSubPlanId = SQLHelper.GetNewID(typeof(Model.DriverSub_DriverSubPlan));
|
|
this.hdId.Text = newData.DriverSubPlanId;
|
|
}
|
|
BLL.DriverSubPlanService.AddDriverSubPlan(newData);
|
|
}
|
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 获取字符串
|
|
/// </summary>
|
|
/// <param name="array"></param>
|
|
/// <returns></returns>
|
|
private string GetStringByArray(string[] array)
|
|
{
|
|
string str = string.Empty;
|
|
foreach (var item in array)
|
|
{
|
|
if (item != BLL.Const._Null)
|
|
{
|
|
str += item + ",";
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(str))
|
|
{
|
|
str = str.Substring(0, str.LastIndexOf(","));
|
|
}
|
|
return str;
|
|
}
|
|
#endregion
|
|
}
|
|
} |