Exemplo n.º 1
0
    protected void btnUserUpdate_Click(object sender, EventArgs e)
    {
        User           = Convert.ToInt32(hidUserIDVal.Value);
        hidValue.Value = hidValue.Value.Replace("`", "");
        string groupID = hidValue.Value.Replace(",", "','");

        string whereCond = " and psecGroupID in ('" + groupID.Remove(groupID.Length - 3, 3) + "')";

        //InsertUserGroup
        string    columnValue = "";
        DataTable dtUpdate    = employee.GetSecurityData(UserID, whereCond);

        //string secUserId = employee.GetSecUserID(lblUserName.Text);

        //string columnvalues = "'" + User + "','" + lblUserName.Text + "','"+Session["UserName"].ToString()+"','"+ DateTime.Now.ToShortDateString()+"'";
        //secUserId = employee.InsertSecurityUser(columnvalues);


        foreach (DataRow dr in dtUpdate.Rows)
        {
            columnValue = "'" + dr["ListValue"].ToString() + "'," +
                          "'" + dr["GroupCd"].ToString() + "'," + UserID + ", " +
                          "'" + Session["UserName"].ToString() + "'," +
                          "'" + DateTime.Now.ToShortDateString() + "'";

            employee.InsertUserGroup(columnValue);
        }
        columnValue    = "";
        hidValue.Value = "";

        BindUserGrid();
        BindSecurityGrid();

        ScriptManager.RegisterClientScriptBlock(btnUserUpdate, btnUserUpdate.GetType(), "Cursor", "document.form1.style.cursor='auto';", true);
        upnlGroupGrid.Update();
        upnlSecurityGrid.Update();
    }