protected void Page_Load(object sender, EventArgs e) { base.AllowHttpMethod("POST"); base.DisableTop(false); base.BodyClass = "class='bodybg'"; if (Page.PreviousPage != null) { if (PreviousPage.IsCrossPagePostBack == true) { System_PowerM_RolePowerSetting_Add page = (System_PowerM_RolePowerSetting_Add)PreviousPage; RoleName = page.RoleName; RoleDescription = page.RoleDescription; OrgLevelEnum orgLevelEnum = page.orgLevelEnum; orgLevelEnumString = Enum.GetName(typeof(OrgLevelEnum), page.orgLevelEnum); if (RoleName.Length == 0) { Response.Redirect("~/System/PowerM/RolePowerSetting_Add.aspx"); } else { MyTreeData = GetMenu(); } } } else { Response.Redirect("~/System/PowerM/RolePowerSetting_Add.aspx"); } }
protected new void Page_Load(object sender, EventArgs e) { base.AllowHttpMethod("POST"); base.DisableTop(true); if (Page.PreviousPage != null) { if (PreviousPage.IsCrossPagePostBack == true) { System_PowerM_RolePowerSetting_Add page = (System_PowerM_RolePowerSetting_Add)PreviousPage; RoleName = PureString(page.RoleName); RoleDescription = PureString(page.RoleDescription); int RoleLevel = page.RoleLevel; RoleLevelName = PureString(page.RoleLevelName); int tmRoleCateID = GetNumber <int>("hfCateID"); if (tmRoleCateID == 0) { tmRoleCateID = 1; } RoleCateID = tmRoleCateID; RoleCateName = GetString("hfCateName"); if (RoleName.Length == 0) { Response.Redirect("~/System/PowerM/RolePowerSetting_Add.aspx"); } else { MyTreeData = GetMenu(); } var user = AuthServer.GetLoginUser(); Dictionary <string, object> OutDict = new Dictionary <string, object>() { { "@OutRoleID", OutRoleID } }; MSDB.ExecuteNonQuery("ConnUser", "dbo.usp_PowerM_xAddRole" , ref OutDict , new Dictionary <string, object>() { { "@RoleName", RoleName }, { "@RoleLevel", RoleLevel }, { "@RoleDescription", RoleDescription }, { "@RoleCateID", RoleCateID }, { "@CreatedUserID", user.ID } }); OutRoleID = (int)OutDict["@OutRoleID"]; string script = ""; if (OutRoleID <= 0) { script = "<script>alert('儲存失敗');location.href = '/System/PowerM/RolePowerSetting.aspx';</script>"; Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false); } else { hfR.Value = OutRoleID.ToString(); } } } else if (this.IsPostBack == true) { MyTreeData = GetMenu(); DataTable dt = MSDB.GetDataTable("ConnUser", "dbo.usp_PowerM_xGetRoleByID" , new Dictionary <string, object>() { { "@ID", int.Parse(hfR.Value) } }); RolePowerSettingVM VM = new RolePowerSettingVM(); EntityS.FillModel(VM, dt); RoleName = VM.RoleName; RoleDescription = VM.RoleDescription; int RoleLevel = VM.RoleLevel; switch (VM.RoleLevel) { case 1: RoleLevelName = "中央"; break; case 2: RoleLevelName = "區管中心"; break; case 3: RoleLevelName = "局"; break; case 4: RoleLevelName = "所"; break; } } else { Response.Redirect("~/System/PowerM/RolePowerSetting_Add.aspx"); } }