Init YZ_BASF
This commit is contained in:
@@ -0,0 +1,158 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using BLL;
|
||||
|
||||
namespace FineUIPro.Web.PublicInfo.FileControl
|
||||
{
|
||||
public partial class CompanyStandardsEdit : PageBase
|
||||
{
|
||||
#region 定义变量
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
private string CompanyStandardsId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["CompanyStandardsId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["CompanyStandardsId"] = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 加载
|
||||
/// <summary>
|
||||
///加载页面
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
//整理人
|
||||
this.drpCompileMan.DataTextField = "UserName";
|
||||
this.drpCompileMan.DataValueField = "UserId";
|
||||
this.drpCompileMan.DataSource = BLL.Sys_UserService.GetUserList();
|
||||
this.drpCompileMan.DataBind();
|
||||
Funs.FineUIPleaseSelect(this.drpCompileMan, Resources.Lan.PleaseSelect);
|
||||
|
||||
this.CompanyStandardsId = Request.Params["CompanyStandardsId"];
|
||||
if (!string.IsNullOrEmpty(this.CompanyStandardsId))
|
||||
{
|
||||
Model.FileControl_CompanyStandards companyStandards = BLL.FileControl_CompanyStandardsService.GetCompanyStandardsById(this.CompanyStandardsId);
|
||||
if (companyStandards != null)
|
||||
{
|
||||
this.txtCompanyStandardsCode.Text = companyStandards.CompanyStandardsCode;
|
||||
this.txtCompanyStandardsName.Text = companyStandards.CompanyStandardsName;
|
||||
this.txtAbstract.Text = companyStandards.Abstract;
|
||||
if (!string.IsNullOrEmpty(companyStandards.CompileMan))
|
||||
{
|
||||
this.drpCompileMan.SelectedValue = companyStandards.CompileMan;
|
||||
}
|
||||
if (companyStandards.CompileDate.HasValue)
|
||||
{
|
||||
this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", companyStandards.CompileDate);
|
||||
}
|
||||
this.txtRemark.Text = companyStandards.Remarks;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.drpCompileMan.SelectedValue = this.CurrUser.UserId;
|
||||
this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存
|
||||
/// <summary>
|
||||
/// 保存按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.CompanyStandardsMenuId, Const.BtnSave))
|
||||
{
|
||||
SaveData("1");//保存方法
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存方法
|
||||
/// </summary>
|
||||
private void SaveData(string state)
|
||||
{
|
||||
//判断编号是否存在
|
||||
var q1 = Funs.DB.FileControl_CompanyStandards.FirstOrDefault(x => x.CompanyStandardsCode == this.txtCompanyStandardsCode.Text.Trim() && (x.CompanyStandardsId.ToString() != this.CompanyStandardsId || (this.CompanyStandardsId == null && x.CompanyStandardsId != null)));
|
||||
if (q1 != null)
|
||||
{
|
||||
Alert.ShowInTop(Resources.Lan.CompanyStandardsCodeExists, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
//判断名称是否存在
|
||||
var q2 = Funs.DB.FileControl_CompanyStandards.FirstOrDefault(x => x.CompanyStandardsName == this.txtCompanyStandardsName.Text.Trim() && (x.CompanyStandardsId.ToString() != this.CompanyStandardsId || (this.CompanyStandardsId == null && x.CompanyStandardsId != null)));
|
||||
if (q2 != null)
|
||||
{
|
||||
Alert.ShowInTop(Resources.Lan.CompanyStandardsNameExists, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
Model.FileControl_CompanyStandards newCompanyStandards = new Model.FileControl_CompanyStandards();
|
||||
newCompanyStandards.CompanyStandardsCode = this.txtCompanyStandardsCode.Text.Trim();
|
||||
newCompanyStandards.CompanyStandardsName = this.txtCompanyStandardsName.Text.Trim();
|
||||
newCompanyStandards.Abstract = this.txtAbstract.Text.Trim();
|
||||
if (this.drpCompileMan.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
newCompanyStandards.CompileMan = this.drpCompileMan.SelectedValue;
|
||||
}
|
||||
newCompanyStandards.CompileDate = Funs.GetNewDateTime(this.txtCompileDate.Text.Trim());
|
||||
newCompanyStandards.Remarks = this.txtRemark.Text.Trim();
|
||||
if (!string.IsNullOrEmpty(this.CompanyStandardsId))
|
||||
{
|
||||
newCompanyStandards.CompanyStandardsId = this.CompanyStandardsId;
|
||||
BLL.FileControl_CompanyStandardsService.UpdateCompanyStandards(newCompanyStandards);
|
||||
BLL.Sys_LogService.AddLog(Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.CompanyStandardsMenuId, Const.BtnDelete, newCompanyStandards.CompanyStandardsId);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.CompanyStandardsId = SQLHelper.GetNewID(typeof(Model.FileControl_CompanyStandards));
|
||||
newCompanyStandards.CompanyStandardsId = this.CompanyStandardsId;
|
||||
BLL.FileControl_CompanyStandardsService.AddCompanyStandards(newCompanyStandards);
|
||||
BLL.Sys_LogService.AddLog(Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.CompanyStandardsMenuId, Const.BtnDelete, newCompanyStandards.CompanyStandardsId);
|
||||
}
|
||||
if (state == "1")
|
||||
{
|
||||
ShowNotify(Resources.Lan.SaveSuccessfully, MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 附件上传
|
||||
/// <summary>
|
||||
/// 上传附件资源
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnAttachUrl_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.CompanyStandardsId))
|
||||
{
|
||||
SaveData("0");
|
||||
}
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/FileControl/CompanyStandards&menuId={1}&edit=1", this.CompanyStandardsId, BLL.Const.CompanyStandardsMenuId)));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user