150 lines
6.1 KiB
C#
150 lines
6.1 KiB
C#
|
using BLL;
|
|||
|
using System;
|
|||
|
|
|||
|
namespace FineUIPro.Web.TestRun.DriverRun
|
|||
|
{
|
|||
|
public partial class DriverRunPlanEdit : 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);
|
|||
|
BLL.UnitWorkService.InitUnitWorkDropDownList(this.drpUnitWorkIds, this.CurrUser.LoginProjectId, true);
|
|||
|
string id = Request.Params["id"];
|
|||
|
if (!string.IsNullOrEmpty(id))
|
|||
|
{
|
|||
|
Model.DriverRun_DriverRunPlan data = BLL.DriverRunPlanService.GetDriverRunPlanById(id);
|
|||
|
if (data != null)
|
|||
|
{
|
|||
|
this.hdId.Text = id;
|
|||
|
this.txtCode.Text = data.Code;
|
|||
|
if (!string.IsNullOrEmpty(data.UnitId))
|
|||
|
{
|
|||
|
this.drpUnitId.SelectedValue = data.UnitId;
|
|||
|
}
|
|||
|
this.drpUnitWorkIds.SelectedValueArray = data.InstallationId.Split(',');
|
|||
|
if (data.EstimatedInsuredPersonNum != null)
|
|||
|
{
|
|||
|
this.txtEstimatedInsuredPersonNum.Text = data.EstimatedInsuredPersonNum.ToString();
|
|||
|
}
|
|||
|
if (data.GuaranteedOperationPeriod != null)
|
|||
|
{
|
|||
|
this.txtGuaranteedOperationPeriod.Text = data.GuaranteedOperationPeriod.ToString();
|
|||
|
}
|
|||
|
if (data.TotalGuaranteedOperationDays != null)
|
|||
|
{
|
|||
|
this.txtTotalGuaranteedOperationDays.Text = data.TotalGuaranteedOperationDays.ToString();
|
|||
|
}
|
|||
|
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_DriverRunPlan));
|
|||
|
}
|
|||
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/TestRun/DriverRun/DriverRunPlan&menuId={1}", this.hdId.Text, BLL.Const.DriverRunPlanMenuId)));
|
|||
|
}
|
|||
|
#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_DriverRunPlan newData = new Model.DriverRun_DriverRunPlan();
|
|||
|
newData.Code = this.txtCode.Text.Trim();
|
|||
|
if (this.drpUnitId.SelectedValue != BLL.Const._Null)
|
|||
|
{
|
|||
|
newData.UnitId = this.drpUnitId.SelectedValue;
|
|||
|
}
|
|||
|
if (!string.IsNullOrEmpty(this.drpUnitWorkIds.SelectedValue))
|
|||
|
{
|
|||
|
newData.InstallationId = GetStringByArray(this.drpUnitWorkIds.SelectedValueArray);
|
|||
|
string unitWorkNames = string.Empty;
|
|||
|
foreach (var item in this.drpUnitWorkIds.SelectedValueArray)
|
|||
|
{
|
|||
|
var unitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(item);
|
|||
|
if (unitWork != null)
|
|||
|
{
|
|||
|
unitWorkNames += unitWork.UnitWorkName + ",";
|
|||
|
}
|
|||
|
}
|
|||
|
if (!string.IsNullOrEmpty(unitWorkNames))
|
|||
|
{
|
|||
|
newData.InstallationNames = unitWorkNames.Substring(0, unitWorkNames.LastIndexOf(","));
|
|||
|
}
|
|||
|
}
|
|||
|
newData.EstimatedInsuredPersonNum = Funs.GetNewInt(this.txtEstimatedInsuredPersonNum.Text.Trim());
|
|||
|
newData.GuaranteedOperationPeriod = Funs.GetNewInt(this.txtGuaranteedOperationPeriod.Text.Trim());
|
|||
|
newData.TotalGuaranteedOperationDays = Funs.GetNewInt(this.txtTotalGuaranteedOperationDays.Text.Trim());
|
|||
|
newData.Remark = this.txtRemark.Text.Trim();
|
|||
|
newData.ProjectId = this.CurrUser.LoginProjectId;
|
|||
|
if (!string.IsNullOrEmpty(id))
|
|||
|
{
|
|||
|
newData.DriverRunPlanId = id;
|
|||
|
BLL.DriverRunPlanService.UpdateDriverRunPlan(newData);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (!string.IsNullOrEmpty(this.hdId.Text))
|
|||
|
{
|
|||
|
newData.DriverRunPlanId = this.hdId.Text.Trim();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
newData.DriverRunPlanId = SQLHelper.GetNewID(typeof(Model.DriverRun_DriverRunPlan));
|
|||
|
this.hdId.Text = newData.DriverRunPlanId;
|
|||
|
}
|
|||
|
BLL.DriverRunPlanService.AddDriverRunPlan(newData);
|
|||
|
}
|
|||
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|||
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|||
|
}
|
|||
|
|
|||
|
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
|
|||
|
}
|
|||
|
}
|