20220315 代码初始化上传
This commit is contained in:
@@ -0,0 +1,149 @@
|
||||
using BLL;
|
||||
using System;
|
||||
|
||||
namespace FineUIPro.Web.CQMS.DataBase
|
||||
{
|
||||
public partial class StartWorkEdit : PageBase
|
||||
{
|
||||
#region 加载
|
||||
/// <summary>
|
||||
/// 加载页面
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
BLL.CNProfessionalService.InitCNProfessionalDownList(this.drpCNProfessionalId, true);//专业
|
||||
BLL.UnitWorkService.InitUnitWorkDownList(this.drpUnitWorkIds, this.CurrUser.LoginProjectId, false);//单位工程
|
||||
BLL.UnitService.GetUnit(this.drpUnitIds, this.CurrUser.LoginProjectId, false);//责任单位
|
||||
string startWorkReportId = Request.Params["startWorkReportId"];
|
||||
string dataTypeProjectId = Request.Params["dataTypeProjectId"];
|
||||
string cNProfessionalId = Request.Params["cNProfessionalId"];
|
||||
|
||||
if (!string.IsNullOrEmpty(cNProfessionalId))
|
||||
{
|
||||
this.drpCNProfessionalId.SelectedValue = cNProfessionalId;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(startWorkReportId))
|
||||
{
|
||||
var startWorkReport = BLL.StartWorkReportService.GetStartWorkReportById(startWorkReportId);
|
||||
if (startWorkReport!=null)
|
||||
{
|
||||
this.txtFileCode.Text = startWorkReport.FileCode;
|
||||
this.txtFileContent.Text = startWorkReport.FileContent;
|
||||
if (!string.IsNullOrEmpty(startWorkReport.CNProfessionalId))
|
||||
{
|
||||
this.drpCNProfessionalId.SelectedValue = startWorkReport.CNProfessionalId;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(startWorkReport.UnitWorkIds))
|
||||
{
|
||||
this.drpUnitWorkIds.SelectedValueArray = startWorkReport.UnitWorkIds.Split(',');
|
||||
}
|
||||
if (!string.IsNullOrEmpty(startWorkReport.UnitIds))
|
||||
{
|
||||
this.drpUnitIds.SelectedValueArray = startWorkReport.UnitIds.Split(',');
|
||||
}
|
||||
this.txtRemark.Text = startWorkReport.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.DataBase_StartWorkReport));
|
||||
}
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CommonUpLoadFile&menuId={1}", this.hdId.Text, BLL.Const.DataBaseProjectMenuId)));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存
|
||||
/// <summary>
|
||||
/// 保存按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.drpCNProfessionalId.SelectedValue == BLL.Const._Null)
|
||||
{
|
||||
Alert.ShowInTop("请选择专业", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
string startWorkReportId = Request.Params["startWorkReportId"];
|
||||
string dataTypeProjectId = Request.Params["dataTypeProjectId"];
|
||||
string cNProfessionalId = Request.Params["cNProfessionalId"];
|
||||
Model.DataBase_StartWorkReport newStartWorkReport = new Model.DataBase_StartWorkReport();
|
||||
newStartWorkReport.ProjectId = this.CurrUser.LoginProjectId;
|
||||
newStartWorkReport.DataTypeProjectId = dataTypeProjectId;
|
||||
newStartWorkReport.FileCode = this.txtFileCode.Text.Trim();
|
||||
newStartWorkReport.FileContent = this.txtFileContent.Text.Trim();
|
||||
if (this.drpCNProfessionalId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
newStartWorkReport.CNProfessionalId = this.drpCNProfessionalId.SelectedValue;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.drpUnitWorkIds.SelectedValue))
|
||||
{
|
||||
newStartWorkReport.UnitWorkIds = GetStringByArray(this.drpUnitWorkIds.SelectedValueArray);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.drpUnitIds.SelectedValue))
|
||||
{
|
||||
newStartWorkReport.UnitIds = GetStringByArray(this.drpUnitIds.SelectedValueArray);
|
||||
}
|
||||
newStartWorkReport.Remark = this.txtRemark.Text.Trim();
|
||||
if (!string.IsNullOrEmpty(startWorkReportId))
|
||||
{
|
||||
newStartWorkReport.StartWorkReportId = startWorkReportId;
|
||||
BLL.StartWorkReportService.UpdateStartWorkReport(newStartWorkReport);
|
||||
}
|
||||
else
|
||||
{
|
||||
newStartWorkReport.CompileMan = this.CurrUser.UserId;
|
||||
newStartWorkReport.CompileDate = DateTime.Now;
|
||||
if (!string.IsNullOrEmpty(this.hdId.Text.Trim()))
|
||||
{
|
||||
newStartWorkReport.StartWorkReportId = this.hdId.Text.Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
newStartWorkReport.StartWorkReportId = SQLHelper.GetNewID(typeof(Model.DataBase_StartWorkReport));
|
||||
this.hdId.Text = newStartWorkReport.StartWorkReportId;
|
||||
}
|
||||
BLL.StartWorkReportService.AddStartWorkReport(newStartWorkReport);
|
||||
}
|
||||
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 转换
|
||||
private string GetStringByArray(string[] array)
|
||||
{
|
||||
string str = string.Empty;
|
||||
foreach (var item in array)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item))
|
||||
{
|
||||
str += item + ",";
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(str))
|
||||
{
|
||||
str = str.Substring(0, str.LastIndexOf(","));
|
||||
}
|
||||
return str;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user