OpRoleModify.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:5k
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using com.etong.DAL.FC;
- public partial class SysManage_OpRoleModify : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- Response.Buffer = true;
- Response.ExpiresAbsolute = System.DateTime.Now;
- Response.Expires = 0;
- Response.CacheControl = "no-cache";
- EtongFlyChouWFPrj EFlyPrj = new EtongFlyChouWFPrj();
- DataView dv = EFlyPrj.GetOpPermAll();
- ChList.DataTextField = "DisplayName";
- ChList.DataValueField = "PermID";
- ChList.DataSource = dv;
- ChList.DataBind();
- //新添加
- EtongWord EWord = new EtongWord();
- dv = EWord.GetAllFName();
- ChFName.DataTextField = "FName";
- ChFName.DataValueField = "FID";
- ChFName.DataSource = dv;
- ChFName.DataBind();
- //新新添加
- EtongFlyChou EFly = new EtongFlyChou();
- dv = EFly.GetEmpType();
- DLstSort.DataTextField = "name";
- DLstSort.DataValueField = "id";
- DLstSort.DataSource = dv;
- DLstSort.DataBind();
-
- if (Request.QueryString["strN"].Trim() == "M")
- {
- int iOp;
- try
- {
- iOp = Convert.ToInt32(Request.QueryString["strOp"].Trim());
- }
- catch
- {
- iOp = 1;
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:参数错误!');window.close()", true);
- return;
- }
- EFlyPrj.OpID = iOp;
- dv = EFlyPrj.GetOpRoleByOp();
- DataView dv2 = EFlyPrj.GetOpPerm();
- if (dv.Table.Rows.Count > 0)
- {
- TID.Text = dv.Table.Rows[0]["OpName"].ToString();
- //新新修改
- //TDesc.Text = dv.Table.Rows[0]["OrgDesc"].ToString();
- DLstSort.Items.FindByValue(DLstSort.SelectedValue).Selected = false;
- DLstSort.Items.FindByValue(dv.Table.Rows[0]["OrgDesc"].ToString()).Selected = true;
- }
- for (int i = 0; i < dv2.Table.Rows.Count; i++)
- {
- for (int j = 0; j < ChList.Items.Count; j++)
- {
- if (dv2.Table.Rows[i][0].ToString().Trim() == ChList.Items[j].Value.ToString().Trim()) ChList.Items[j].Selected = true;
- }
- }
- //新添加
- EWord.Role = iOp;
- dv = EWord.GetRoleFNameByCondition();
- for (int k = 0; k < dv.Table.Rows.Count; k++)
- {
- ChFName.Items[k].Selected = dv.Table.Rows[k][0].ToString().Trim() == ChFName.Items[k].Value.ToString().Trim() ? true:false;
- }
- }
- }
- }
- protected void ImgSave_Click(object sender, ImageClickEventArgs e)
- {
- int iOp;
- try
- {
- iOp = Convert.ToInt32(Request.QueryString["strOp"].Trim());
- }
- catch
- {
- iOp = 1;
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:参数错误!');window.close()", true);
- return;
- }
- EtongFlyChouWFPrj EFlyPrj = new EtongFlyChouWFPrj();
- EFlyPrj.OpID = iOp;
- EFlyPrj.OpName = TID.Text.Trim();
- //新新修改
- //EFlyPrj.OpDesc = TDesc.Text.Trim();
- EFlyPrj.OpDesc = DLstSort.SelectedValue.ToString();
- ArrayList al = new ArrayList();
- for (int i = 0; i < ChList.Items.Count; i++)
- {
- if (ChList.Items[i].Selected == true) al.Add(ChList.Items[i].Value);
- }
- EFlyPrj.OpPerm = al;
- try
- {
- EFlyPrj.UpOpPerm();
- }
- catch (Exception ex)
- {
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + ex.Message.Replace("'", "").Replace("rn", "").Replace("n", "") + "');</script>");
- return;
- }
- ArrayList alf = new ArrayList();
- for (int k = 0; k < ChFName.Items.Count; k++)
- {
- if (ChFName.Items[k].Selected == true) alf.Add(ChFName.Items[k].Value);
- }
- EtongWord EWord = new EtongWord();
- try
- {
- EWord.Role = iOp;
- EWord.AFID = alf;
- EWord.RUpdate();
- }
- catch (Exception ex)
- {
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + ex.Message.Replace("'", "").Replace("rn", "").Replace("n", "") + "');</script>");
- return;
- }
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:保存成功!');window.close();", true);
- }
- }