提交定制会内容
This commit is contained in:
@@ -0,0 +1,201 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
public partial class QualityAssuranceEdit : PageBase
|
||||
{
|
||||
#region 定义项
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public string QualityAssuranceId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["QualityAssuranceId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["QualityAssuranceId"] = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 项目主键
|
||||
/// </summary>
|
||||
public string ProjectId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["ProjectId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["ProjectId"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
//public string UnitId
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return (string)ViewState["UnitId"];
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// ViewState["UnitId"] = value;
|
||||
// }
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region 加载
|
||||
/// <summary>
|
||||
/// 加载页面
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.ProjectId = this.CurrUser.LoginProjectId;
|
||||
//this.UnitId = Request.Params["UnitId"];
|
||||
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
this.InitDropDownList();
|
||||
|
||||
this.QualityAssuranceId = Request.Params["QualityAssuranceId"];
|
||||
if (!string.IsNullOrEmpty(this.QualityAssuranceId))
|
||||
{
|
||||
var getData = BLL.QualityAssuranceService.GetQualityAssuranceById(this.QualityAssuranceId);
|
||||
if (getData != null)
|
||||
{
|
||||
this.ProjectId = getData.ProjectId;
|
||||
//this.UnitId = getData.UnitId;
|
||||
if (this.ProjectId != this.CurrUser.LoginProjectId)
|
||||
{
|
||||
this.InitDropDownList();
|
||||
}
|
||||
this.txtCode.Text = getData.QualityAssuranceCode;
|
||||
this.txtName.Text = getData.QualityAssuranceName;
|
||||
if (!string.IsNullOrEmpty(getData.QualityAssuranceType))
|
||||
{
|
||||
this.drpType.SelectedValue = getData.QualityAssuranceType;
|
||||
}
|
||||
this.txtContents.Text = HttpUtility.HtmlDecode(getData.ContentTexts);
|
||||
if (!string.IsNullOrEmpty(getData.CompileMan))
|
||||
{
|
||||
this.drpCompileMan.SelectedValue = getData.CompileMan;
|
||||
}
|
||||
this.txtCompileDate.Text = getData.CompileDate.HasValue ? string.Format("{0:yyyy-MM-dd}", getData.CompileDate) : "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.drpCompileMan.SelectedValue = this.CurrUser.PersonId;
|
||||
this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
||||
//var codeTemplateRule = BLL.ProjectData_CodeTemplateRuleService.GetProjectData_CodeTemplateRuleByMenuIdProjectId(BLL.Const.ProjectThemeActivitiesMenuId, this.ProjectId);
|
||||
//if (codeTemplateRule != null)
|
||||
//{
|
||||
// this.txtContents.Text = HttpUtility.HtmlDecode(codeTemplateRule.Template);
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 初始化下拉框
|
||||
/// </summary>
|
||||
private void InitDropDownList()
|
||||
{
|
||||
//类别
|
||||
this.drpType.DataValueField = "Value";
|
||||
this.drpType.DataTextField= "Text";
|
||||
this.drpType.DataSource= BLL.DropListService.drpQualityAssuranceTypeList();
|
||||
this.drpType.DataBind();
|
||||
Funs.FineUIPleaseSelect(this.drpType);
|
||||
|
||||
Person_PersonsService.InitFlowOperateControlUserDropDownList(this.drpCompileMan, this.ProjectId,string.Empty, true);
|
||||
this.drpCompileMan.SelectedValue = this.CurrUser.PersonId;
|
||||
}
|
||||
|
||||
#region 保存
|
||||
/// <summary>
|
||||
/// 保存按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.drpType.SelectedValue==BLL.Const._Null)
|
||||
{
|
||||
Alert.ShowInTop("请选择类别", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
this.SaveData(BLL.Const.BtnSave);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存数据
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
private void SaveData(string type)
|
||||
{
|
||||
Model.Comprehensive_QualityAssurance newData = new Model.Comprehensive_QualityAssurance
|
||||
{
|
||||
ProjectId = this.ProjectId,
|
||||
QualityAssuranceCode = this.txtCode.Text.Trim(),
|
||||
QualityAssuranceName = this.txtName.Text.Trim(),
|
||||
CompileDate = Funs.GetNewDateTime(this.txtCompileDate.Text.Trim()),
|
||||
};
|
||||
if (this.drpType.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
newData.QualityAssuranceType = this.drpType.SelectedValue;
|
||||
}
|
||||
if (this.drpCompileMan.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
newData.CompileMan = this.drpCompileMan.SelectedValue;
|
||||
}
|
||||
newData.ContentTexts = HttpUtility.HtmlEncode(this.txtContents.Text);
|
||||
if (!string.IsNullOrEmpty(this.QualityAssuranceId))
|
||||
{
|
||||
newData.QualityAssuranceId = this.QualityAssuranceId;
|
||||
BLL.QualityAssuranceService.UpdateQualityAssurance(newData);
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, newData.QualityAssuranceCode, newData.QualityAssuranceId, BLL.Const.CQMS_QualityAssuranceMenuId, BLL.Const.BtnModify);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.QualityAssuranceId = SQLHelper.GetNewID(typeof(Model.Comprehensive_QualityAssurance));
|
||||
newData.QualityAssuranceId = this.QualityAssuranceId;
|
||||
BLL.QualityAssuranceService.AddQualityAssurance(newData);
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, newData.QualityAssuranceCode, newData.QualityAssuranceId, BLL.Const.CQMS_QualityAssuranceMenuId, BLL.Const.BtnAdd);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 附件上传
|
||||
/// <summary>
|
||||
/// 上传附件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnAttachUrl_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.QualityAssuranceId))
|
||||
{
|
||||
SaveData(BLL.Const.BtnSave);
|
||||
}
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/QualityAssuranceAttachUrl&menuId={1}", QualityAssuranceId, BLL.Const.CQMS_QualityAssuranceMenuId)));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user