protected void Page_Load(object sender, EventArgs e) { base.AllowHttpMethod("GET"); base.DisableTop(false); base.BodyClass = "class='bodybg'"; MyTreeData = GetMenu(); int.TryParse(Request["i"], out ID); if (ID == 0) { string script = "<script>alert('資料取得失敗');history.go(-1);</script>"; Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "alert", script, false); } DataTable dt = new DataTable(); using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnUser"].ToString())) { using (SqlCommand cmd = new SqlCommand("dbo.usp_PowerM_xGetRoleByID", sc)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@ID", ID); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { sc.Open(); da.Fill(dt); } } } RolePowerSettingVM VM = new RolePowerSettingVM(); EntityS.FillModel(VM, dt); RoleName = VM.RoleName; RoleDescription = VM.RoleDescription; switch (VM.OrgLevel) { case 1: orgLevelEnumString = "中央"; break; case 2: orgLevelEnumString = "區管中心"; break; case 3: orgLevelEnumString = "局"; break; case 4: orgLevelEnumString = "所"; break; } }
protected void Page_Load(object sender, EventArgs e) { ViewPower = base.GetPower(PowerList[0]); UpdatePower = base.GetPower(PowerList[1]); base.AllowHttpMethod("GET", "POST"); base.DisableTop(true); base.BodyClass = "class='bodybg'"; if (Request.HttpMethod.Equals("POST")) { int.TryParse(Request.Form["i"], out ID); int.TryParse(Request.Form["mc"], out ModuleCateID); MyTreeData = GetMenu(); if (this.IsPostBack == false) { hfR.Value = ID.ToString(); if (ID == 0 || ModuleCateID == 0) { string script = "<script>alert('資料取得失敗');location.href='/System/PowerM/RolePowerSetting.aspx';</script><style>body{display:none;}</style>"; Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false); return; } } DataSet ds = new DataSet(); using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnUser"].ToString())) { using (SqlCommand cmd = new SqlCommand("dbo.usp_PowerM_xGetRoleAndModuleByRoleID", sc)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@RoleID", ID); cmd.Parameters.AddWithValue("@RoleCateID", ModuleCateID); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { sc.Open(); da.Fill(ds); } } } RolePowerSettingVM VM = new RolePowerSettingVM(); List <RolePowerSettingPowerVM> list = new List <RolePowerSettingPowerVM>(); EntityS.FillModel(VM, ds.Tables[0]); EntityS.FillModel(list, ds.Tables[1]); tbAry = JsonConvert.SerializeObject(list); RoleName = VM.RoleName; RoleDescription = VM.RoleDescription; switch (VM.RoleLevel) { case 1: RoleLevelName = "中央"; break; case 2: RoleLevelName = "區管中心"; break; case 3: RoleLevelName = "局"; break; case 4: RoleLevelName = "所"; break; } } else { Response.Write(""); Response.End(); } }
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"); } }
protected new void Page_Load(object sender, EventArgs e) { base.AllowHttpMethod("GET", "POST"); base.DisableTop(true); ViewPower = base.GetPower(PowerList[0]); UpdatePower = base.GetPower(PowerList[1]); if (Request.HttpMethod.Equals("POST")) { ID = GetNumber <int>("i"); if (this.IsPostBack == false) { hfR.Value = ID.ToString(); if (ID == 0) { IsValid = false; string script = "<style>body{display:none;}</style><script>alert('資料取得失敗');history.go(-1);</script>"; Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false); return; } } Dictionary <string, object> OutDict = new Dictionary <string, object>() { { "@RoleCateID", ModuleCateID } }; DataSet ds = MSDB.GetDataSet("ConnUser", "dbo.usp_PowerM_xGetRoleAndModuleByRoleID" , ref OutDict , new Dictionary <string, object>() { { "@RoleID", ID } }); ModuleCateID = (int)OutDict["@RoleCateID"]; MyTreeData = GetMenu(); RolePowerSettingVM VM = new RolePowerSettingVM(); List <RolePowerSettingPowerVM> list = new List <RolePowerSettingPowerVM>(); EntityS.FillModel(VM, ds.Tables[0]); EntityS.FillModel(list, ds.Tables[1]); tbAry = JsonConvert.SerializeObject(list); RoleName = VM.RoleName; RoleDescription = VM.RoleDescription; switch (VM.RoleLevel) { case 1: RoleLevelName = "中央"; break; case 2: RoleLevelName = "區管中心"; break; case 3: RoleLevelName = "局"; break; case 4: RoleLevelName = "所"; break; } } else { Response.Write(""); Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { base.AllowHttpMethod("GET", "POST"); base.DisableTop(true); ViewPower = base.GetPower(PowerList[0]); UpdatePower = base.GetPower(PowerList[1]); if (Request.HttpMethod.Equals("POST")) { if (UpdatePower.HasPower == false) { tbName.Enabled = false; tbDesp.Enabled = false; rb1.Enabled = false; rb2.Enabled = false; rb3.Enabled = false; rb4.Enabled = false; } ID = GetNumber <int>("i"); if (this.IsPostBack == false) { if (ID == 0) { IsValid = false; string script = "<script>alert('資料取得失敗');history.go(-1);</script>"; Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false); return; } DataTable dt = GetDataTable("ConnUser", "dbo.usp_PowerM_xGetRoleByID" , new Dictionary <string, object>() { { "@ID", ID } }); RolePowerSettingVM VM = new RolePowerSettingVM(); EntityS.FillModel(VM, dt); tbName.Text = VM.RoleName; tbDesp.Text = VM.RoleDescription; switch (VM.RoleLevel) { case 1: rb1.Checked = true; break; case 2: rb2.Checked = true; break; case 3: rb3.Checked = true; break; case 4: rb4.Checked = true; break; } } } else { Response.Write(""); Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { ViewPower = base.GetPower(PowerList[0]); UpdatePower = base.GetPower(PowerList[1]); base.AllowHttpMethod("GET", "POST"); base.DisableTop(true); base.BodyClass = "class='bodybg'"; if (Request.HttpMethod.Equals("POST")) { if (UpdatePower.HasPower == false) { tbName.Enabled = false; tbDesp.Enabled = false; rb1.Enabled = false; rb2.Enabled = false; rb3.Enabled = false; rb4.Enabled = false; } int.TryParse(Request.Form["i"], out ID); if (this.IsPostBack == false) { if (ID == 0) { string script = "<script>alert('資料取得失敗');history.go(-1);</script>"; Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false); return; } DataTable dt = new DataTable(); using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnUser"].ToString())) { using (SqlCommand cmd = new SqlCommand("dbo.usp_PowerM_xGetRoleByID", sc)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@ID", ID); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { sc.Open(); da.Fill(dt); } } } RolePowerSettingVM VM = new RolePowerSettingVM(); EntityS.FillModel(VM, dt); tbName.Text = VM.RoleName; tbDesp.Text = VM.RoleDescription; switch (VM.RoleLevel) { case 1: rb1.Checked = true; break; case 2: rb2.Checked = true; break; case 3: rb3.Checked = true; break; case 4: rb4.Checked = true; break; } } } else { Response.Write(""); Response.End(); } }