protected void btnDel_Click(object sender, EventArgs e) { int index = usrGV.SelectedIndex; int itemIdex = usrGV.Rows[index].DataItemIndex; DataTable dt = (Session["upDtSources"] as DataTable).DefaultView.ToTable(); string usrId = dt.Rows[itemIdex]["usrId"].ToString(); UserProcess up = Session["UserProcess"] as UserProcess; up.usrDel(usrId); up.UsrSelfDepartTitleView(); DataTable upTable = up.MyDst.Tables["view_usr_department_title"]; Session["upDtSources"] = upTable; usrGV.DataSource = Session["upDtSources"]; usrGV.DataBind(); Button btn = sender as Button; btn.Visible = false; btn = btnCancel; btn.Visible = false; btn = btnAdd; btn.Visible = true; usrGV.SelectedIndex = -1; usrGV.Enabled = true; }
protected void btnOk_Click(object sender, EventArgs e) { int index = usrGV.SelectedIndex; DropDownList ddl = null; ddl = (usrGV.Rows[index].FindControl("ddlDep") as DropDownList); string strDepId = ddl.SelectedValue.ToString(); ddl.Enabled = false; ddl = (usrGV.Rows[index].FindControl("ddlTitle") as DropDownList); string strTitleId = ddl.SelectedValue.ToString(); ddl.Enabled = false; Button btn = null; btn = (usrGV.Rows[index].FindControl("btnCancle") as Button); btn.Visible = false; btn = sender as Button; btn.Visible = false; UserProcess up = Session["UserProcess"] as UserProcess; DataTable dt = (Session["upDtSources"] as DataTable).DefaultView.ToTable(); int itemIndex = usrGV.Rows[index].DataItemIndex; string oldDepId = dt.Rows[itemIndex]["departmentId"].ToString(); string oldTitleId = dt.Rows[itemIndex]["titleId"].ToString(); if (!strDepId.Equals(oldDepId)) { int usrDepId = int.Parse(dt.Rows[itemIndex]["usrDepId"].ToString()); int usrId = int.Parse(dt.Rows[itemIndex]["usrId"].ToString()); int depId = int.Parse(strDepId); up.SelfUsrDepartUpdate(usrDepId, usrId, depId); } if (!strTitleId.Equals(oldTitleId)) { int usrTitleId = int.Parse(dt.Rows[itemIndex]["usrTitleId"].ToString()); int usrId = int.Parse(dt.Rows[itemIndex]["usrId"].ToString()); int titleId = int.Parse(strTitleId); up.SelfUsrTitleUpdate(usrTitleId, usrId, titleId); } up.UsrSelfDepartTitleView(); DataTable upTable = up.MyDst.Tables["view_usr_department_title"]; Session["upDtSources"] = upTable; usrGV.DataSource = Session["upDtSources"]; usrGV.SelectedIndex = -1; usrGV.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!(null == Session["totleAuthority"])) { AuthAttributes usrAuthAttr = (AuthAttributes)Session["totleAuthority"]; bool flag = usrAuthAttr.HasOneFlag(AuthAttributes.systemManager); if (!flag) { Response.Redirect("~/Main/NoAuthority.aspx"); } } else { string url = Request.FilePath; Session["backUrl"] = url; Response.Redirect("~/Account/Login.aspx"); } //DataSet MyDst = new DataSet(); //SelfDepartProcess myView = new SelfDepartProcess(MyDst); if (!IsPostBack) { DataSet upDst = new DataSet(); UserProcess upView = new UserProcess(upDst); upView.UsrSelfDepartTitleView(); DataTable upTable = upView.MyDst.Tables["view_usr_department_title"]; Session["UserProcess"] = upView; Session["upDtSources"] = upTable; //if (Session["PAGESIZE"] != null) //{ // SelfDepartGV.DataSource = Session["dtSources"];//["dtSources"] as DataTable; // SelfDepartGV.DataBind(); //} //else //{ //} usrGV.DataSource = Session["upDtSources"];//["dtSources"] as DataTable; //string[] strKeyNames = new string[1]; //strKeyNames[0] = "departmentName"; //SelfDepartGV.DataKeyNames = strKeyNames; usrGV.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!(null == Session["totleAuthority"])) { AuthAttributes usrAuthAttr = (AuthAttributes)Session["totleAuthority"]; bool flag = usrAuthAttr.HasOneFlag(AuthAttributes.selfCompany); if (!flag) { Response.Redirect("~/Main/NoAuthority.aspx"); } } else { string url = Request.FilePath; Session["backUrl"] = url; Response.Redirect("~/Account/Login.aspx"); } //DataSet MyDst = new DataSet(); //SelfDepartProcess myView = new SelfDepartProcess(MyDst); if (!IsPostBack) { DataSet upDst = new DataSet(); DataSet sdDst = new DataSet(); DataSet stDst = new DataSet(); UserProcess upView = new UserProcess(upDst); SelfDepartProcess sdView = new SelfDepartProcess(sdDst); SelfTitleProcess stView = new SelfTitleProcess(stDst); upView.UsrSelfDepartTitleView(); sdView.RealDepView(); stView.RealTitleView(); DataTable upTable = upView.MyDst.Tables["view_usr_department_title"]; DataTable sdTable = sdView.MyDst.Tables["tbl_department"]; DataTable stTable = stView.MyDst.Tables["tbl_title"]; //DataColumn[] sdKey = new DataColumn[1]; //DataColumn[] stKey = new DataColumn[1]; //sdKey[0] = sdTable.Columns[1]; //stKey[0] = stTable.Columns[1]; //sdTable.PrimaryKey = sdKey; //stTable.PrimaryKey = stKey; //object findVals = new object(); //findVals = "无"; Session["UserProcess"] = upView; Session["upDtSources"] = upTable; Session["sdDtSources"] = sdTable; Session["stDtSources"] = stTable; //if (Session["PAGESIZE"] != null) //{ // SelfDepartGV.DataSource = Session["dtSources"];//["dtSources"] as DataTable; // SelfDepartGV.DataBind(); //} //else //{ //} usrGV.DataSource = Session["upDtSources"];//["dtSources"] as DataTable; //string[] strKeyNames = new string[1]; //strKeyNames[0] = "departmentName"; //SelfDepartGV.DataKeyNames = strKeyNames; usrGV.DataBind(); } }