protected void Button_All_Reporting_User_Click(object sender, EventArgs e)
        {
            Dictionary <String, userDetails> allReportingUsers = (Dictionary <String, userDetails>)BackEndObjects.
                                                                 userDetails.
                                                                 getAllReportingUserDB(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString(),
                                                                                       ((Label)GridView_User_List.SelectedRow.Cells[0].FindControl("Label_User_Id")).Text);

            if (allReportingUsers != null && allReportingUsers.Count > 0)
            {
                Label_Reporting_Users.Visible = false;
                DataTable dt = new DataTable();
                dt.Columns.Add("userId");
                dt.Columns.Add("Name");

                int i = 0;
                foreach (KeyValuePair <String, userDetails> kvp in allReportingUsers)
                {
                    dt.Rows.Add();
                    dt.Rows[i]["userId"] = kvp.Key;
                    dt.Rows[i]["Name"]   = kvp.Value.getName();
                    i++;
                }
                Cache.Remove("userMgmtAllReportingUsers");
                Cache["userMgmtAllReportingUsers"]          = dt;
                GridView_Reporting_Users.Columns[0].Visible = false;
                GridView_Reporting_Users.DataSource         = dt;
                GridView_Reporting_Users.DataBind();
                GridView_Reporting_Users.Visible = true;
            }
            else
            {
                GridView_Reporting_Users.Visible = false;
                Label_Reporting_Users.Visible    = true;
                Label_Reporting_Users.Text       = "No user reporting to this user";
                Label_Reporting_Users.ForeColor  = System.Drawing.Color.Red;
            }
            Panel_Reporting_Users.Visible = true;
        }
        protected void GridView_Reporting_Users_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            GridViewRow gVR    = GridView_Reporting_Users.Rows[e.RowIndex];
            String      userId = ((Label)gVR.Cells[0].FindControl("Label_UserId")).Text;

            Dictionary <String, String> whereCls   = new Dictionary <string, string>();
            Dictionary <String, String> targetVals = new Dictionary <string, string>();

            whereCls.Add(BackEndObjects.userDetails.USER_DETAILS_COL_USERID, userId);
            whereCls.Add(BackEndObjects.userDetails.USER_DETAILS_COL_BUSINESS_ID, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
            targetVals.Add(BackEndObjects.userDetails.USER_DETAILS_COL_REPORTS_TO, "");
            BackEndObjects.userDetails.updateUserDetailsDB(targetVals, whereCls, DBConn.Connections.OPERATION_UPDATE);

            DataTable dt    = (DataTable)Cache["userMgmtAllDirectReportingUsers"];
            int       index = GridView_Reporting_Users.Rows[e.RowIndex].DataItemIndex;

            dt.Rows[index].Delete();

            DataTable allUsers = (DataTable)Session[SessionFactory.ADMIN_PREF_USER_MGMT_BASIC_USER_DET_GRID];

            for (int i = 0; i < allUsers.Rows.Count; i++)
            {
                if (allUsers.Rows[i]["UserId"].ToString().Equals(userId))
                {
                    allUsers.Rows[i]["reportsTo"] = ""; break;
                }
            }

            Cache["userMgmtAllDirectReportingUsers"] = dt;
            GridView_Reporting_Users.DataSource      = dt;
            GridView_Reporting_Users.DataBind();

            GridView_User_List.DataSource = allUsers;
            GridView_User_List.DataBind();
            Session[SessionFactory.ADMIN_PREF_USER_MGMT_BASIC_USER_DET_GRID] = allUsers;
        }
 protected void GridView_Reporting_Users_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     GridView_Reporting_Users.PageIndex  = e.NewPageIndex;
     GridView_Reporting_Users.DataSource = (DataTable)Cache["userMgmtAllReportingUsers"];
     GridView_Reporting_Users.DataBind();
 }