protected void btnDel_Click(object sender, EventArgs e) { int index = SelfDepartGV.SelectedIndex; int dataIndex = SelfDepartGV.Rows[index].DataItemIndex; DataTable dt = (DataTable)Session["dtSources"]; int depId = int.Parse(dt.DefaultView[dataIndex].Row["departmentId"].ToString()); Button btn = null; btn = (SelfDepartGV.Rows[index].FindControl("btnUpdate") as Button); btn.Visible = false; btn = (SelfDepartGV.Rows[index].FindControl("btnCancle") as Button); btn.Visible = false; btn = sender as Button; btn.Visible = false; SelfDepartProcess sdp = Session["SelfDepartProcess"] as SelfDepartProcess; sdp.SelfDepDel(depId); sdp.SelDepView(); DataTable taskTable = sdp.MyDst.Tables["tbl_department"]; Session["dtSources"] = sdp.MyDst.Tables["tbl_department"] as DataTable; SelfDepartGV.DataSource = Session["dtSources"]; SelfDepartGV.SelectedIndex = -1; SelfDepartGV.EditIndex = -1; SelfDepartGV.DataBind(); btnAdd.Enabled = true; }
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"); } if (!IsPostBack) { DataSet MyDst = new DataSet(); SelfDepartProcess myView = new SelfDepartProcess(MyDst); myView.SelDepView(); DataTable taskTable = myView.MyDst.Tables["tbl_department"]; Session["SelfDepartProcess"] = myView; Session["dtSources"] = taskTable; SelfDepartGV.DataSource = Session["dtSources"];//["dtSources"] as DataTable; SelfDepartGV.DataBind(); } }
protected void btnUpdate_Click(object sender, EventArgs e) { int index = SelfDepartGV.SelectedIndex; int dataIndex = SelfDepartGV.Rows[index].DataItemIndex; DataTable dt = (DataTable)Session["dtSources"]; GridViewRow row = SelfDepartGV.Rows[index]; TextBox tbDepName = row.Cells[1].Controls[0] as TextBox; string newDepName = tbDepName.Text.ToString().Trim(); string strCheck = newDepName; newDepName = input_check(strCheck.Trim()); if (newDepName.Equals(strCheck)) { int depId = int.Parse(dt.DefaultView[dataIndex].Row["departmentId"].ToString()); SelfDepartProcess sdp = Session["SelfDepartProcess"] as SelfDepartProcess; sdp.SelfDepUpdate(depId, newDepName); sdp.SelDepView(); DataTable taskTable = sdp.MyDst.Tables["tbl_department"]; Session["dtSources"] = sdp.MyDst.Tables["tbl_department"] as DataTable; Button btn = null; btn = (SelfDepartGV.Rows[index].FindControl("btnDel") as Button); btn.Visible = false; btn = (SelfDepartGV.Rows[index].FindControl("btnCancle") as Button); btn.Visible = false; btn = sender as Button; btn.Visible = false; SelfDepartGV.SelectedIndex = -1; SelfDepartGV.EditIndex = -1; SelfDepartGV.DataSource = Session["dtSources"];//["dtSources"] as DataTable; SelfDepartGV.DataBind(); btnAdd.Enabled = true; } else { tbDepName.Text = newDepName; SelfDepartGV.SelectedIndex = index; SelfDepartGV.EditIndex = index; } }
protected void btnAccept_Click(object sender, EventArgs e) { SelfDepartProcess sdp = Session["SelfDepartProcess"] as SelfDepartProcess; string newDepName = txtDepName.Text.ToString().Trim(); string strCheck = newDepName; newDepName = input_check(strCheck.Trim()); if (newDepName.Equals(strCheck)) { sdp.SelfDepAdd(newDepName); //sdp.SelDepView(); //DataTable taskTable = sdp.MyDst.Tables["tbl_department"]; ////taskTable.DefaultView.RowFilter = //// "isDel = " + bool.FalseString.ToString().Trim() + " and departmentName <> '无' "; //Session["dtSources"] = sdp.MyDst.Tables["tbl_department"] as DataTable; //SelfDepartGV.DataSource = Session["dtSources"];//["dtSources"] as DataTable; //SelfDepartGV.DataBind(); //SelfDepartGV.Enabled = true; //lblDepName.Visible = false; //txtDepName.Text = string.Empty; //txtDepName.Visible = false; //btnAccept.Visible = false; //btnNo.Visible = false; //btnAdd.Enabled = true; Response.Redirect("~/Main/self_depart_title/selfDep/SelfDepartment.aspx"); } else { txtDepName.Text = newDepName; } }
protected void Page_Load(object sender, EventArgs e) { // txtName.ContinueDestinationPageUrl = Request.QueryString["ReturnUrl"]; if (!(null == Session["totleAuthority"])) { AuthAttributes usrAuthAttr = (AuthAttributes)Session["totleAuthority"]; bool flag = usrAuthAttr.HasOneFlag(AuthAttributes.projectTagApply); if (!flag) { Response.Redirect("~/Main/NoAuthority.aspx"); } } else { string url = Request.FilePath; Session["backUrl"] = url; Response.Redirect("~/Account/Login.aspx"); } if (!IsPostBack) { DataSet dst = new DataSet(); DataRow dr = null; #region ddlSelfDepartView SelfDepartProcess ddlSelfDepartView = new SelfDepartProcess(dst); ddlSelfDepartView.SelDepView(); DataTable ddlSelfDepartTable = ddlSelfDepartView.MyDst.Tables["tbl_department"].DefaultView.ToTable(); dr = ddlSelfDepartTable.NewRow(); dr["departmentId"] = -1; dr["departmentName"] = string.Empty; dr["endTime"] = "9999-12-31"; ddlSelfDepartTable.Rows.Add(dr); ddlDepart.DataValueField = "departmentId"; ddlDepart.DataTextField = "departmentName"; ddlDepart.DataSource = ddlSelfDepartTable; ddlDepart.DataBind(); ddlDepart.SelectedValue = "-1"; #endregion #region ddlSelfTitleView SelfTitleProcess ddlSelfTitleView = new SelfTitleProcess(dst); ddlSelfTitleView.SelfTitleView(); DataTable ddlSelfTitleTable = ddlSelfTitleView.MyDst.Tables["tbl_title"].DefaultView.ToTable(); dr = ddlSelfTitleTable.NewRow(); dr["titleId"] = -1; dr["titleName"] = string.Empty; dr["endTime"] = "9999-12-31"; ddlSelfTitleTable.Rows.Add(dr); ddlTitle.DataValueField = "titleId"; ddlTitle.DataTextField = "titleName"; ddlTitle.DataSource = ddlSelfTitleTable; ddlTitle.DataBind(); ddlTitle.SelectedValue = "-1"; #endregion } }
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(); } }