CNCEC_SUBQHSE_WUHUAN/SGGL/FineUIPro.Web/TestRun/DriverReport/PropertyReportEdit.aspx.cs

133 lines
5.3 KiB
C#
Raw Permalink Normal View History

2021-04-30 10:28:37 +08:00
using BLL;
using System;
2024-04-10 14:37:59 +08:00
using System.Collections.Generic;
2021-04-30 10:28:37 +08:00
namespace FineUIPro.Web.TestRun.DriverReport
{
public partial class PropertyReportEdit : PageBase
{
#region
/// <summary>
/// 页面加载
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
2024-03-18 15:59:06 +08:00
//BLL.UnitWorkService.InitUnitWorkDropDownList(this.drpUnitWorkId, this.CurrUser.LoginProjectId, true);
2021-04-30 10:28:37 +08:00
string id = Request.Params["id"];
if (!string.IsNullOrEmpty(id))
{
Model.Driver_DriverReport data = BLL.DriverReportService.GetDriverReportById(id);
if (data != null)
{
this.hdId.Text = id;
2024-03-18 15:59:06 +08:00
//if (!string.IsNullOrEmpty(data.UnitWorkId))
//{
// this.drpUnitWorkId.SelectedValue = data.UnitWorkId;
//}
2021-04-30 10:28:37 +08:00
this.txtDriverReportCode.Text = data.DriverReportCode;
this.txtDriverReporName.Text = data.DriverReporName;
this.txtCompilePerson.Text = BLL.UserService.GetUserNameByUserId(data.CompilePerson);
this.txtSubmitDate.Text = data.SubmitDate.HasValue ? string.Format("{0:yyyy-MM-dd}", data.SubmitDate) : "";
2024-03-18 15:59:06 +08:00
//this.txtNumber.Text = data.Number;
2021-04-30 10:28:37 +08:00
this.txtRemark.Text = data.Remark;
2024-04-10 14:37:59 +08:00
WindowAtt_Close(null, null);
2021-04-30 10:28:37 +08:00
}
}
else
{
this.txtCompilePerson.Text = this.CurrUser.UserName;
this.txtSubmitDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
}
}
}
#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.Driver_DriverReport));
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/TestRun/DriverReport/PropertyReport&menuId={1}", this.hdId.Text, BLL.Const.PropertyReportMenuId)));
}
2024-04-10 14:37:59 +08:00
protected void WindowAtt_Close(object sender, WindowCloseEventArgs e)
{
this.lbtnAttach.Text = string.Empty;
string url = string.Empty;
var attLists = BLL.AttachFileService.Getfiles(this.hdId.Text, BLL.Const.PropertyReportMenuId);
if (attLists != null)
{
List<string> lists = Funs.GetStrListByStr(attLists.AttachUrl, ',');
if (lists.Count > 0)
{
foreach (var item in lists)
{
url += item.Substring(item.IndexOf('_') + 1) + "\r\n";
}
}
if (!string.IsNullOrEmpty(url))
{
this.lbtnAttach.Text = url;
}
}
}
2021-04-30 10:28:37 +08:00
#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.Driver_DriverReport newData = new Model.Driver_DriverReport();
2024-03-18 15:59:06 +08:00
//if (this.drpUnitWorkId.SelectedValue != BLL.Const._Null)
//{
// newData.UnitWorkId = this.drpUnitWorkId.SelectedValue;
//}
2021-04-30 10:28:37 +08:00
newData.DriverReportCode = this.txtDriverReportCode.Text.Trim();
newData.DriverReporName = this.txtDriverReporName.Text.Trim();
newData.CompilePerson = this.CurrUser.UserId;
newData.SubmitDate = Funs.GetNewDateTime(this.txtSubmitDate.Text.Trim());
2024-03-18 15:59:06 +08:00
//newData.Number = this.txtNumber.Text.Trim();
2021-04-30 10:28:37 +08:00
newData.Remark = this.txtRemark.Text.Trim();
newData.ProjectId = this.CurrUser.LoginProjectId;
if (!string.IsNullOrEmpty(id))
{
newData.DriverReportId = id;
BLL.DriverReportService.UpdateDriverReport(newData);
}
else
{
newData.ReportType = "5";
if (!string.IsNullOrEmpty(this.hdId.Text))
{
newData.DriverReportId = this.hdId.Text.Trim();
}
else
{
newData.DriverReportId = SQLHelper.GetNewID(typeof(Model.Driver_DriverReport));
this.hdId.Text = newData.DriverReportId;
}
BLL.DriverReportService.AddDriverReport(newData);
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
#endregion
}
}