升级
This commit is contained in:
@@ -11,61 +11,90 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
public partial class RewardAndPunishEdit : PageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 项目id
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public string RewardAndPunishID
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["RewardAndPunishID"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["RewardAndPunishID"] = value;
|
||||
}
|
||||
} /// <summary>
|
||||
/// 图片是否可以编辑 -1查看 0编辑
|
||||
/// </summary>
|
||||
get { return (string)ViewState["RewardAndPunishID"]; }
|
||||
set { ViewState["RewardAndPunishID"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 图片是否可以编辑 -1查看 0编辑
|
||||
/// </summary>
|
||||
public int QuestionImg
|
||||
{
|
||||
get
|
||||
{
|
||||
return Convert.ToInt32(ViewState["QuestionImg"]);
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["QuestionImg"] = value;
|
||||
}
|
||||
get { return Convert.ToInt32(ViewState["QuestionImg"]); }
|
||||
set { ViewState["QuestionImg"] = value; }
|
||||
}
|
||||
|
||||
public string SysTemType
|
||||
{
|
||||
get { return (string)ViewState["SysTemType"]; }
|
||||
set { ViewState["SysTemType"] = value; }
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
BLL.RewardAndPunishService.InitTypeDropDownList(drpType);
|
||||
//UnitService.InitUnitDownList(drpResponseUnit, this.CurrUser.LoginProjectId, false);
|
||||
UnitService.InitUnitByProjectIdUnitTypeDropDownList(drpResponseUnit, this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2, false);
|
||||
drpTeamGroup.DataValueField = "TeamGroupId";
|
||||
drpTeamGroup.DataTextField = "TeamGroupName";
|
||||
drpTeamGroup.DataSource = TeamGroupService.GetTeamGroupList(this.CurrUser.LoginProjectId);
|
||||
drpTeamGroup.DataBind();
|
||||
Funs.FineUIPleaseSelect(drpTeamGroup, null);
|
||||
|
||||
UnitService.InitUnitByProjectIdUnitTypeDropDownList(drpResponseUnit, this.CurrUser.LoginProjectId, "", true);
|
||||
this.SysTemType = Request.Params["sysTemType"];
|
||||
|
||||
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
RewardAndPunishID = Request.Params["RewardAndPunishID"];
|
||||
if (!string.IsNullOrEmpty(RewardAndPunishID))
|
||||
{
|
||||
this.hdId.Text = RewardAndPunishID;
|
||||
|
||||
|
||||
Model.Check_RewardAndPunish RewardAndPunish = BLL.RewardAndPunishService.GetRewardAndPunishById(RewardAndPunishID);
|
||||
if (RewardAndPunish != null)
|
||||
{
|
||||
this.CurrUser.LoginProjectId = RewardAndPunish.ProjectId;
|
||||
|
||||
this.drpRewardAndPunishType.SelectedValue = RewardAndPunish.RewardAndPunishType;
|
||||
|
||||
if (RewardAndPunish.Type.HasValue)
|
||||
{
|
||||
this.drpType.SelectedValue = RewardAndPunish.Type.Value.ToString();
|
||||
if (!string.IsNullOrEmpty(RewardAndPunish.ResponseUnit))
|
||||
drpRewardAndPunishType_Click(sender, e);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(RewardAndPunish.ResponseUnit))
|
||||
{
|
||||
this.drpResponseUnit.SelectedValue = RewardAndPunish.ResponseUnit;
|
||||
}
|
||||
|
||||
if (RewardAndPunish.Money.HasValue)
|
||||
{
|
||||
this.txtMoney.Text = RewardAndPunish.Money.Value.ToString();
|
||||
}
|
||||
|
||||
if (RewardAndPunish.Date.HasValue)
|
||||
{
|
||||
this.dpDate.Text = string.Format("{0:yyyy-MM-dd}", RewardAndPunish.Date.Value);
|
||||
}
|
||||
this.txtDescription.Text = RewardAndPunish.Description;
|
||||
|
||||
this.txtRewardAndPunishCode.Text = RewardAndPunish.RewardAndPunishCode;
|
||||
|
||||
if (!string.IsNullOrEmpty(RewardAndPunish.RewardAndPunishType))
|
||||
{
|
||||
this.drpRewardAndPunishType.SelectedValue = RewardAndPunish.RewardAndPunishType;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(RewardAndPunish.RewardAndPunishMan))
|
||||
{
|
||||
this.drpRewardAndPunishMan.SelectedValue = RewardAndPunish.RewardAndPunishMan;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(RewardAndPunish.TeamGroupId))
|
||||
{
|
||||
this.drpTeamGroup.SelectedValue = RewardAndPunish.TeamGroupId;
|
||||
}
|
||||
this.txtRemark.Text = RewardAndPunish.Remark;
|
||||
if (this.CurrUser.UserId == RewardAndPunish.CreateMan)
|
||||
{
|
||||
QuestionImg = 1;
|
||||
@@ -77,26 +106,50 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
drpType_OnSelectedIndexChanged(sender, e);
|
||||
}
|
||||
drpResponseUnit_OnSelectedIndexChanged(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void WindowAtt_Close(object sender, WindowCloseEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected void imgBtnFile_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.hdId.Text)) //新增记录
|
||||
if (string.IsNullOrEmpty(this.hdId.Text)) //新增记录
|
||||
{
|
||||
this.hdId.Text = SQLHelper.GetNewID(typeof(Model.Check_CheckControl));
|
||||
}
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/CheckControl&menuId={2}", QuestionImg, this.hdId.Text, BLL.Const.RewardAndPunishMenuId)));
|
||||
|
||||
var model = BLL.RewardAndPunishService.GetRewardAndPunishById(this.hdId.Text);
|
||||
if (model != null && model.HazardRegisterId != null)
|
||||
{
|
||||
Model.HSSE_Hazard_HazardRegister register =
|
||||
BLL.HSSE_Hazard_HazardRegisterService.GetHazardRegisterByHazardRegisterId(model.HazardRegisterId);
|
||||
DateTime date = Convert.ToDateTime(register.CheckTime);
|
||||
string dateStr = date.Year.ToString() + date.Month.ToString();
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format(
|
||||
"~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/Registration/" + dateStr +
|
||||
"&menuId={1}&edit={2}", register.HazardRegisterId, Const.HSSE_HiddenRectificationListMenuId, "1")));
|
||||
}
|
||||
else
|
||||
{
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format(
|
||||
"../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/CheckControl&menuId={2}",
|
||||
QuestionImg, this.hdId.Text, BLL.Const.RewardAndPunishMenuId)));
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (BLL.CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.RewardAndPunishMenuId, BLL.Const.BtnSave))
|
||||
if (BLL.CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, this.CurrUser.UserId,
|
||||
BLL.Const.RewardAndPunishMenuId, BLL.Const.BtnSave))
|
||||
{
|
||||
SaveData();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -113,18 +166,37 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
}
|
||||
RewardAndPunish.ProjectId = this.CurrUser.LoginProjectId;
|
||||
RewardAndPunish.Type = int.Parse(this.drpType.SelectedValue);
|
||||
|
||||
RewardAndPunish.ResponseUnit = this.drpResponseUnit.SelectedValue;
|
||||
|
||||
RewardAndPunish.Money = Decimal.Parse(this.txtMoney.Text);
|
||||
|
||||
// RewardAndPunish.NoticeUnit = this.drpNoticeUnit.SelectedValue;
|
||||
if (!string.IsNullOrWhiteSpace(this.txtMoney.Text))
|
||||
{
|
||||
decimal moneyValue;
|
||||
if (decimal.TryParse(this.txtMoney.Text.Trim(), out moneyValue))
|
||||
{
|
||||
RewardAndPunish.Money = moneyValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("金额必须为有效数字!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
RewardAndPunish.Date = Convert.ToDateTime(this.dpDate.Text.Trim());
|
||||
RewardAndPunish.Description = this.txtDescription.Text;
|
||||
RewardAndPunish.CreateMan = this.CurrUser.UserId;
|
||||
RewardAndPunish.RewardAndPunishType = this.drpRewardAndPunishType.SelectedValue;
|
||||
RewardAndPunish.RewardAndPunishCode = this.txtRewardAndPunishCode.Text;
|
||||
RewardAndPunish.RewardAndPunishMan = this.drpRewardAndPunishMan.SelectedValue;
|
||||
RewardAndPunish.TeamGroupId = this.drpTeamGroup.SelectedValue;
|
||||
RewardAndPunish.Remark = this.txtRemark.Text.Trim();
|
||||
RewardAndPunish.DataSource = "0";
|
||||
RewardAndPunish.SysTemType = this.SysTemType;
|
||||
|
||||
if (string.IsNullOrEmpty(this.hdId.Text.Trim()))
|
||||
{
|
||||
RewardAndPunish.RewardAndPunishID = Guid.NewGuid().ToString();
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(RewardAndPunishID))
|
||||
{
|
||||
BLL.RewardAndPunishService.AddRewardAndPunish(RewardAndPunish);
|
||||
@@ -132,12 +204,67 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
else
|
||||
{
|
||||
BLL.RewardAndPunishService.UpdateRewardAndPunish(RewardAndPunish);
|
||||
|
||||
}
|
||||
ShowNotify("提交成功!", MessageBoxIcon.Success);
|
||||
|
||||
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
|
||||
#region 单位下拉框事件
|
||||
|
||||
/// <summary>
|
||||
/// 单位下拉框事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void drpResponseUnit_OnSelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.drpResponseUnit.SelectedValue))
|
||||
{
|
||||
//根据单位和项目获取人员
|
||||
BLL.PersonService.InitPersonByProjectUnitDropDownList(this.drpRewardAndPunishMan,
|
||||
this.CurrUser.LoginProjectId, this.drpResponseUnit.SelectedValue, false);
|
||||
}
|
||||
}
|
||||
|
||||
protected void drpUser_OnSelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.drpRewardAndPunishMan.SelectedValue))
|
||||
{
|
||||
this.drpTeamGroup.SelectedValue = BLL.PersonService.GetPersonById(this.drpRewardAndPunishMan.SelectedValue).TeamGroupId;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
protected void drpType_OnSelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (this.drpType.SelectedValue == "1")
|
||||
{
|
||||
// this.txtRewardAndPunishCode.Text = BLL.SQLHelper.RunProcNewId("SpGetNewCode5",
|
||||
// "Check_RewardAndPunish", "RewardAndPunishCode", $"JL");
|
||||
this.txtRewardAndPunishCode.Text = BLL.RewardAndPunishService.getCode(SysTemType,"JL");
|
||||
}
|
||||
else
|
||||
{
|
||||
// this.txtRewardAndPunishCode.Text = BLL.SQLHelper.RunProcNewId("SpGetNewCode5",
|
||||
// "Check_RewardAndPunish", "RewardAndPunishCode", $"CF");
|
||||
this.txtRewardAndPunishCode.Text = BLL.RewardAndPunishService.getCode(SysTemType,"CF");
|
||||
}
|
||||
drpRewardAndPunishType_Click(sender, e);
|
||||
}
|
||||
|
||||
protected void drpRewardAndPunishType_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.drpType.SelectedValue == "1")
|
||||
{
|
||||
ConstValue.InitConstValueDropDownList(this.drpRewardAndPunishType, "RewardType", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ConstValue.InitConstValueDropDownList(this.drpRewardAndPunishType, "PunishType", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user