150 lines
5.9 KiB
C#
150 lines
5.9 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Web;
|
||
using System.Web.UI.WebControls;
|
||
using SuperMap.RealEstate.Utility;
|
||
using SuperMap.RealEstate.Web.UI;
|
||
using SuperMap.RealEstate.Web.UI.WebControls;
|
||
using Business = SuperMap.RealEstate.FrameWork.Business;
|
||
using HZQR.Common;
|
||
|
||
namespace Personnel.WebSite.Modules.Users
|
||
{
|
||
public partial class UserPage : BasePage
|
||
{
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (IsPostBack) return;
|
||
|
||
TreeViewUserRole.Nodes.Clear();
|
||
if (Request["ID"] != null)
|
||
{
|
||
User1.CurrObject.User_ID_Encrypt = Request["ID"];
|
||
User1.Select();
|
||
try
|
||
{
|
||
new Business.UserRole(Transaction).BindingRoleTreeView(User1.CurrObject.User_ID.ToString(), TreeViewUserRole.Nodes);
|
||
(User1.FindControl("User_PassWordE") as TextBoxEx).Text = User1.CurrObject.User_PassWord.ToDecrypt();
|
||
}
|
||
catch
|
||
{
|
||
(User1.FindControl("User_PassWordE") as TextBoxEx).Text = "未加密:" + User1.CurrObject.User_PassWord;
|
||
}
|
||
}
|
||
ButtonVisibleCtrl();
|
||
SetControlConfirm(ButtonDelete, "您确认删除当前用户?");
|
||
SetControlClientAction(ButtonDelete, false, true, true);
|
||
SetControlConfirm(ButtonResetPassWord, "您确认重置当前用户的密码?");
|
||
SetControlClientAction(ButtonResetPassWord, false, true, true);
|
||
SetControlClientAction(ButtonSave);
|
||
}
|
||
|
||
protected void ButtonSave_Click(object sender, EventArgs e)
|
||
{
|
||
try
|
||
{
|
||
if (!User1.Save())
|
||
{
|
||
Transaction.Rollback();
|
||
return;
|
||
}
|
||
TreeViewUserRole.Nodes.Clear();
|
||
new Business.UserRole(Transaction).BindingRoleTreeView(User1.CurrObject.User_ID.ToString(), TreeViewUserRole.Nodes);
|
||
Alert("保存成功!", 3);
|
||
this.Redirect("parent.ObjectTreeView", "UserTypeTree.aspx?Type=User&ID=" +
|
||
User1.CurrObject.User_ID_Encrypt + "&ShowDefault=" + Request["ShowDefault"] + "#selectNode");
|
||
ButtonVisibleCtrl();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//回滚事务
|
||
Transaction.Rollback();
|
||
//记录日志
|
||
ErrorLogHelper.Write(ex);
|
||
#if DEBUG
|
||
Alert("保存失败!可能的原因:\n" + ex.Message);
|
||
#else
|
||
Alert("保存失败!");
|
||
#endif
|
||
}
|
||
}
|
||
|
||
private void ButtonVisibleCtrl()
|
||
{
|
||
ButtonDelete.Enabled = !string.IsNullOrEmpty(User1.CurrObject.KeyID);
|
||
ButtonPopedom.Enabled = ButtonDelete.Enabled;
|
||
BtnUserRole.Enabled = ButtonDelete.Enabled;
|
||
ButtonResetPassWord.Enabled = ButtonDelete.Enabled;
|
||
ButtonPopedomCopy.Enabled = ButtonDelete.Enabled;
|
||
|
||
ButtonPopedom.OnClientClick = this.GetOpenPopDialogClientScript("UserTree.aspx?ID=" +
|
||
User1.CurrObject.User_ID_Encrypt + "&ShowDefault=" + Request["ShowDefault"], "UserTree", 500, 550, true, false, false);
|
||
|
||
ButtonPopedomCopy.OnClientClick = this.GetOpenPopDialogClientScript("UserTreeCopy.aspx?ID=" +
|
||
User1.CurrObject.User_ID_Encrypt + "&ShowDefault=" + Request["ShowDefault"], "UserTree", 500, 550, true, false, false);
|
||
|
||
BtnUserRole.OnClientClick = GetOpenPopDialogClientScript("/Personnel/Modules/Process/UserPage.aspx?ID=" +
|
||
this.User1.CurrObject.User_ID_Encrypt + "&ShowDefault=" + Request["ShowDefault"], "UserTree", 700, 6000, true, false, false);
|
||
}
|
||
|
||
protected void ButtonDelete_Click(object sender, EventArgs e)
|
||
{
|
||
try
|
||
{
|
||
this.User1.BindControlToObject();
|
||
string _Encrypt_PID = this.User1.CurrObject.UserType_ID.ToEncrypt();
|
||
User1.Delete();
|
||
ButtonVisibleCtrl();
|
||
Alert("删除成功!", 3);
|
||
this.Redirect("parent.ObjectTreeView", "UserTypeTree.aspx?Type=UserType&ID=" +
|
||
_Encrypt_PID + "&ShowDefault=" + Request["ShowDefault"] + "#selectNode");
|
||
Redirect(Request.Url.AbsolutePath);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//回滚事务
|
||
Transaction.Rollback();
|
||
//记录日志
|
||
ErrorLogHelper.Write(ex);
|
||
#if DEBUG
|
||
Alert("保存失败!可能的原因:\n" + ex.Message);
|
||
#else
|
||
Alert("保存失败!");
|
||
#endif
|
||
}
|
||
}
|
||
|
||
protected void ButtonResetPassWord_Click(object sender, EventArgs e)
|
||
{
|
||
User1.ResetPassWord(this.Transaction);
|
||
|
||
#region 同步到第三方平台
|
||
string userPhone = User1.USER_MOBILEPHONE.Text;
|
||
int cmd = 1;//更新用户信息
|
||
if (!string.IsNullOrEmpty(User1.User_ID.Text))
|
||
{
|
||
cmd = 2;//更新用户信息
|
||
}
|
||
int userState = User1.User_Status.SelectedValue.TryParseToInt();//1:有效;0:无效
|
||
string userName = User1.User_Name.Text;
|
||
string passPort = User1.User_Passport.Text;
|
||
string userPwd = passPort;
|
||
string pageName = "系统用户保存操作";
|
||
Shanxi.ThirdParty.SysncUserToThird(cmd, userName, passPort, userPwd, userPhone, userState, pageName);
|
||
|
||
#region 同步修改远程数据
|
||
if (!String.IsNullOrEmpty(User1.User_ID.Text))
|
||
{
|
||
Shanxi.ThirdParty.SysDataUpdateUser(userName, "1", passPort, userPwd, userState.ToString());
|
||
}
|
||
else
|
||
{
|
||
Shanxi.ThirdParty.SysDataAddUser(userName, "1", passPort, userPwd);
|
||
}
|
||
#endregion
|
||
|
||
#endregion
|
||
}
|
||
}
|
||
}
|