0813
This commit is contained in:
@@ -0,0 +1,156 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using BLL;
|
||||
|
||||
namespace FineUIPro.Web.Party
|
||||
{
|
||||
public partial class PartyerEdit : PageBase
|
||||
{
|
||||
#region 定义项
|
||||
/// <summary>
|
||||
/// 用户主键
|
||||
/// </summary>
|
||||
public string PartyerId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["PartyerId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["PartyerId"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 签名附件路径
|
||||
/// </summary>
|
||||
public string SignatureUrl
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["SignatureUrl"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["SignatureUrl"] = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <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.GetButtonPower();
|
||||
this.PartyerId = Request.Params["partyerId"];
|
||||
if (!string.IsNullOrEmpty(this.PartyerId))
|
||||
{
|
||||
var partyer = BLL.PartyerService.GetPartyerById(this.PartyerId);
|
||||
if (partyer != null)
|
||||
{
|
||||
this.txtName.Text = partyer.Name;
|
||||
this.txtSex.Text = partyer.Sex;
|
||||
if (partyer.BirthDate != null)
|
||||
{
|
||||
this.txtBirthDate.Text = string.Format("{0:yyyy-MM}",partyer.BirthDate);
|
||||
}
|
||||
this.txtEducation.Text = partyer.Education;
|
||||
this.txtNation.Text = partyer.Nation;
|
||||
if (partyer.JoinPartyDate != null)
|
||||
{
|
||||
this.txtJoinPartyDate.Text = string.Format("{0:yyyy-MM-dd}", partyer.JoinPartyDate);
|
||||
}
|
||||
if (partyer.JoinPostDate != null)
|
||||
{
|
||||
this.txtJoinPostDate.Text = string.Format("{0:yyyy-MM-dd}", partyer.JoinPostDate);
|
||||
}
|
||||
this.txtPost.Text = partyer.Post;
|
||||
this.txtPhone.Text = partyer.Phone;
|
||||
if (partyer.PartyRelationInDate != null)
|
||||
{
|
||||
this.txtPartyRelationInDate.Text = string.Format("{0:yyyy-MM-dd}", partyer.PartyRelationInDate);
|
||||
}
|
||||
if (partyer.PartyRelationOutDate != null)
|
||||
{
|
||||
this.txtPartyRelationOutDate.Text = string.Format("{0:yyyy-MM-dd}", partyer.PartyRelationOutDate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
Model.Party_Partyer newPartyer = new Model.Party_Partyer
|
||||
{
|
||||
Name = this.txtName.Text.Trim(),
|
||||
Sex = this.txtSex.Text.Trim(),
|
||||
Education = this.txtEducation.Text.Trim(),
|
||||
Nation = this.txtNation.Text.Trim(),
|
||||
Post = this.txtPost.Text.Trim(),
|
||||
Phone=this.txtPhone.Text.Trim()
|
||||
};
|
||||
newPartyer.BirthDate = Funs.GetNewDateTime(this.txtBirthDate.Text.Trim()+"-01");
|
||||
newPartyer.JoinPartyDate = Funs.GetNewDateTime(this.txtJoinPartyDate.Text.Trim());
|
||||
newPartyer.JoinPostDate = Funs.GetNewDateTime(this.txtJoinPostDate.Text.Trim());
|
||||
newPartyer.PartyRelationInDate = Funs.GetNewDateTime(this.txtPartyRelationInDate.Text.Trim());
|
||||
newPartyer.PartyRelationOutDate = Funs.GetNewDateTime(this.txtPartyRelationOutDate.Text.Trim());
|
||||
if (string.IsNullOrEmpty(this.PartyerId))
|
||||
{
|
||||
newPartyer.PartyerId = SQLHelper.GetNewID();
|
||||
PartyerService.AddPartyer(newPartyer);
|
||||
LogService.AddSys_Log(this.CurrUser, newPartyer.Name, newPartyer.PartyerId, BLL.Const.PartyerMenuId, BLL.Const.BtnAdd);
|
||||
}
|
||||
else
|
||||
{
|
||||
newPartyer.PartyerId = this.PartyerId;
|
||||
PartyerService.UpdatePartyer(newPartyer);
|
||||
LogService.AddSys_Log(this.CurrUser, newPartyer.Name, newPartyer.PartyerId, BLL.Const.PartyerMenuId, BLL.Const.BtnModify);
|
||||
}
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
||||
}
|
||||
|
||||
#region 获取按钮权限
|
||||
/// <summary>
|
||||
/// 获取按钮权限
|
||||
/// </summary>
|
||||
/// <param name="button"></param>
|
||||
/// <returns></returns>
|
||||
private void GetButtonPower()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
||||
{
|
||||
this.btnSave.Hidden = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.PartyerMenuId);
|
||||
if (buttonList.Count() > 0)
|
||||
{
|
||||
if (buttonList.Contains(BLL.Const.BtnSave))
|
||||
{
|
||||
this.btnSave.Hidden = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user